hellkvist.org Forum Index hellkvist.org
Discussions about the free software on hellkvist.org
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

thumbnail hooks?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    hellkvist.org Forum Index -> Peffisaur
View previous topic :: View next topic  
Author Message
angepange100



Joined: 26 Apr 2004
Posts: 1

PostPosted: Mon Apr 26, 2004 2:54 pm    Post subject: thumbnail hooks? Reply with quote

how do the thumbnail hooks work? my config.php has these lines near the bottom:

/*
"image/gif" => array( "thumbnail_hook" ), // Make a thumbnail
"image/jpeg" => array( "thumbnail_hook" ), // Make a thumbnail
"image/png" => array( "thumbnail_hook" ), // Make a thumbnail
*/


but the images are just the original jpg resized to fit a smaller box?

this causes scrolling problems on slower pc's and generally makes your layout flicker and behave oddly especially when alot of large pics are on the gallery

pls help
Back to top
View user's profile Send private message
Peffis
Site Admin


Joined: 09 Sep 2003
Posts: 324
Location: Sweden

PostPosted: Mon Apr 26, 2004 3:55 pm    Post subject: Reply with quote

The Peffisaur source code started with the code from MMS Diary which is a similar, but much simpler idea around the same concept. That's where the hooks got created so that's why they are still in the code.

A hook is simply a method that is registered for each content type. It will be applied when it the message has been received by send.php and the content has been extracted.

When I later migrated things to Peffisaur (several users, storing in database and so on) the message was stored in a slightly different way so unfortunately a few hooks were commented away due to lack of time to implement it properly.

It would however still be possible to apply the hooks and create thumbnail images when a message arrives if you only uncomment the hooks part from the config. Smaller versions of the files will then be created. The only problem is however that when viewing the page there is currently no code in Peffisaur that discovers that there is a thumbnail image and shows that one instead. So if you enable this and want thumbnails to work you would have to change the viewing code (in lib.php) so that the thumbnail image is selected instead of the real on if it exists (similar to how it is done in MMS Diary).

There is also a second problem in that messages can also be received through the email interface and currently there is no code at all available in that perl script to create thumnails of the image. It would have been better to have written that script in php instead of perl so that the code for message storing could be shared but it's easy to be wise in retrospect.

So, it's currently not fully implemented and to be honest, it won't be right now unless a fairy jof inspiration jumps on me one day (and she has been hiding for some time unfortunately). Therefore to make it work right now you would unfortunately have to do it yourself.
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Mon Apr 26, 2004 7:48 pm    Post subject: Reply with quote

hmm ok, ill see what i can do Smile

thanks anyway! Smile
Back to top
Guest






PostPosted: Sat May 01, 2004 6:10 pm    Post subject: Reply with quote

ive managed to make the page generate the thumbnails each time the page is loaded and will attempt to make a workaround that generates thumbnails and stores them, just know the basics of GD at the moment though Smile If i ever get it working nicely i'll be sure to post the code changes here

One last question, now that my images are thumbs, ive made them slightly smaller, could you tell me how to make more than 2 vertical columns of pictures? would that be simple?
Back to top
Guest






PostPosted: Sat May 01, 2004 6:20 pm    Post subject: Reply with quote

could've swore i logged in, this is Angela by the way :-\
Back to top
Peffis
Site Admin


Joined: 09 Sep 2003
Posts: 324
Location: Sweden

PostPosted: Sat May 01, 2004 8:23 pm    Post subject: Reply with quote

Hi again Angela,

Good to see that you are making progress. About having another column:
In the method showLatestPosts in lib.php there is a simple way how the columns are done - the if ( !($i % 2) ) which means of course that whenever the counter is divisible by two it will make a new row. So...try changing the 2 into whatever column width you prefer.

You might also then want to increase the number of posts that are actually displayed on the page - that is the $nposts variable that the showLatestPosts is called with. The showLatestPosts is called both from index.php with the argument 10 (meaning that 10 posts will be displayed). Try increasing that to say, something bigger that is divisible with your number of columns.

Also then change the call to showSidebar in the same file and increase the second argument there to the same number (this is the list to the right of older posts - the first number is where to start and the second is how many).

There is also another file called home.php which is the posts for a particular user. Change that one in similar manner.

I have no idea though how this renders when you increase the number of columns as I have never tried it. Perhaps things will get weird. I don't know. You might need to increase some hard coded widths (in pixels) of tables here and there unfortunately.

Hope that explanation was ok...or else I try and write some time when I have not had as many beers Smile
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Sat May 01, 2004 9:13 pm    Post subject: Reply with quote

It doesnt seem to increase the amount of columns, there are always two columns no matter what i tweak (i've already had a quick tamper with this paticular function) when the number is an odd number it tends to mess up,

when 2 is changed to 3 the images are laid out as follows:

[-] [-]
[-] [ ]
[-] [ ]
[-] [-]
[-] [-]
[-] [ ]
[-] [ ]

Key:

[-] cell contains image
[ ] cell is empty


-----------

ill keep scratching my head at this but if you figure out an easier way then i'd Love to hear it

thanks,

Angela
Back to top
Peffis
Site Admin


Joined: 09 Sep 2003
Posts: 324
Location: Sweden

PostPosted: Sat May 01, 2004 9:58 pm    Post subject: Reply with quote

I saw there was another one in the same function a bit further down if ( $i % 2 ) it says there. Did you change that one as well? No matter what you change it too they (the two if-statements in that function) must have the same number or the html will be very broken with mismatched tags I'm afraid.
Back to top
View user's profile Send private message Visit poster's website
angepange
Guest





PostPosted: Sun May 02, 2004 12:03 am    Post subject: Reply with quote

hm when i change both to "4" it just changes to

[-] [-]
[-] [ ]
[-] [ ]
[-] [-]
[-] [ ]
[-] [ ]
[-] [-]

Confused
Back to top
Guest






PostPosted: Sun May 02, 2004 10:48 pm    Post subject: Reply with quote

any ideas?

i'm totally stuck Sad Wink
Back to top
Peffis
Site Admin


Joined: 09 Sep 2003
Posts: 324
Location: Sweden

PostPosted: Mon May 03, 2004 10:11 am    Post subject: Reply with quote

Well, without having the actual html-code that is generated after you have made the changes it's hard for me to see why it displays so weirdly. Do you have a public URL to the site? Or care to send me the html-src-dump?

My guess is that it should work by just changing those number but you will also need to adjust sizes of several tables to make it fit. There are tables in tables as you surely know and the top-level ones have maximum sizes and also some of the inner ones. If you increase the number of cells (cells that also have a fixed width) they will not fit and you will get a line break which might be what you are experiencing there from the looks of it.

If you open up index.php for instance you see in the table tag width="864" and then further down a td of width="800". From there it continues with the main window (which is the images table) which has a size of 600.

Each post then has the width of 300 pixels which means that you can squeeze in exactly two in the width of 600. If you want three for instance you would have to increase the width of the surrounding table (make the 600 into...900). But then you will have to continue and increase all the other table sizes (the overall 800 for instance but possibly more in the ever growing chain reaction of table crappiness). It's not the best layout ever produced. I agree to that. It's a bit of a mess unfortunately.

If I get the time (who knows? Hell might freeze over as well) I might be able to make you an index.php and a lib.php which has, say three columns. Four is far to difficult for me and don't get me even thinking of five Wink
Back to top
View user's profile Send private message Visit poster's website
angepange
Guest





PostPosted: Mon May 03, 2004 1:41 pm    Post subject: Reply with quote

ah i see, the code was only designed to make 2 columns , i made this last night in a vain attempt to get 4 columns but it spewed out php errors


Code:


function showLatestPosts( $nposts, $uid = FALSE )
{
?>
   <table width="600" height="100%" cellspacing="0" cellpadding="0">

<?php
   if ( !$uid )
      $query = "SELECT id FROM messages ORDER BY id DESC LIMIT " .
                   "$nposts";
   else
      $query = "SELECT id FROM messages WHERE sender=$uid ORDER " .
                   "BY id DESC LIMIT $nposts";
   $result = mysql_query($query);
   $num_rows = mysql_num_rows( $result );

$eachrow = 3;
$thisrow = 0;
   
   for ( $i = 0; $i < $nposts; $i++ )
   {
if($thisrow == 0)print "<tr>\n";
      if ( $i < $num_rows )
      {
         $line = mysql_fetch_row( $result );
         print( "<td valign=\"top\" height=\"100%\">\n" );
         showPostThumb( $line[0] );
         print( "</td>\n" );
      }
      else
      {
         // Make empty cells if we don't have any posts left
         print( "<td valign=\"top\" height=\"100%\"></td>\n" );
      }

$thisrow++;
if($thisrow == $eachrow)   
   {            
print "</tr>";                     
$thisrow = 0;
}

   }
   print( "</table>\n" );
}


?>




i changed index.php so that the table didnt have a fixed width limit and that didn't change anything

thanks alot for all your help, im pretty sure i can crack it soon Smile

Angela
Back to top
Peffis
Site Admin


Joined: 09 Sep 2003
Posts: 324
Location: Sweden

PostPosted: Tue May 04, 2004 7:48 pm    Post subject: Reply with quote

Good luck!
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    hellkvist.org Forum Index -> Peffisaur All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group