Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorAndromeda
    • CommentTimeMar 18th 2009
     
    Hello

    I have a problem. Many thousands comments in my plogger gallery:

    - The problem is when I see in the ALBUM CONTENT pictures. IS VERY SLOWWWWWWWWWW. so.... maybe the pagination? maybe some "get or preload the comments" of the pictures' albums? (Picture one by one navigation (previous or next) is fast, no problem...)


    If somebody can help me to fix that... I'll pay you.

    Sorry my bad english
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 18th 2009 edited
     
    So Andromeda,

    You are talking about when you view the thumbnails in a single Album that this is slow? Or the first time you click to go to the individual Picture from an Album? Do you happen to have a link?
    • CommentAuthorAndromeda
    • CommentTimeMar 18th 2009 edited
     
    Exactly. When I view the thumbnails in a single Album, all is very slow (and... if I drop in mysql the plogger_comments table, then the gallery is super-mega-hiper fast. But I need the comments.)

    I dont know why... I supose for some code that preload comments on albums. (Individual pictures are great, the slow-problem is on thumbnails of a single albums)

    What do you think?
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 19th 2009 edited
     
    Andromeda,

    I think the slowness happens because Plogger is counting the comments for each image for the comment display overlay (which would take a long time if you have a lot of comments). There are a couple of quick adjustments that may speed up the process for you. It could also be handled via AJAX, but that would take a bit more work.

    Option 1:
    Try this. Open plog-functions.php and find the following code for the function plogger_picture_comment_count() (which should be around line 1939 in the beta3 version):
    function plogger_picture_comment_count() {
    $row = $GLOBALS["current_picture"];
    $comment_query = "SELECT COUNT(*) AS `num_comments` FROM `".TABLE_PREFIX."comments`
    WHERE approved = 1 AND `parent_id`='".$row["id"]."'";

    $comment_result = run_query($comment_query);
    $num_comments = mysql_result($comment_result, 0, 'num_comments');
    return $num_comments;
    }

    and change it to read:
    function plogger_picture_comment_count() {
    $row = $GLOBALS["current_picture"];
    $comment_query = "SELECT COUNT(`id`) AS `num_comments` FROM `".TABLE_PREFIX."comments`
    WHERE approved = 1 AND `parent_id`='".$row["id"]."'";

    $comment_result = run_query($comment_query);
    $num_comments = mysql_result($comment_result, 0, 'num_comments');
    return $num_comments;
    }


    Option 2:
    If that's still too slow, I would recommend just removing the comment count at the album level by opening 'album.php' in the theme file you are using. Assuming you are using the 'default' theme, you would look for the following code:
    $imgtag = '<img id="' . $img_id
    . '" onmouseout="document.getElementById(\'overlay\').style.visibility = \'hidden\';"
    onmouseover="display_overlay(\''.$img_id.'\', \''.plogger_picture_comment_count().'\')" class="photos"
    src="'.plogger_get_picture_thumb().'" title="'.$capt.'" alt="'.$capt.'" />';

    and change it to:
    $imgtag = '<img id="' . $img_id
    . '" src="'.plogger_get_picture_thumb().'" title="'.$capt.'" alt="'.$capt.'" />';


    That should significantly speed up the album display time, although you would lose the overlay effect showing the number of comments. Hopefully we can address this issue for large galleries (either many images, collections, albums, or comments) with a simple total number of children elements in the database (would no longer have to count all the database entries, just pull the number from a single database column).

    Hope that helps as a stopgap in the meantime.
    • CommentAuthorAndromeda
    • CommentTimeMar 20th 2009 edited
     
    Many thanks sidtheduck! for your help! I really apreciate that.

    I followed your instructions (option 1 and option 2) and then my gallery is slow like "always" :(

    I think that plogger no is prepared for manage big galleries, at the moment...
    • CommentAuthorAndromeda
    • CommentTimeMar 20th 2009 edited
     
    Hello Again

    Is very strange... I modifed the "function plogger_search" for find results only from CAPTIONS.

    Well... now, If I search something, plogger IS VERY VERY VERY FAST !!!

    Why search function can be so fast, and view pictures of albums so anynoing slooowwwwwwwwww?

    Sugestions?
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 20th 2009 edited
     
    Andromeda,

    Do you have a link to your gallery? You can email me at sidtheduck SPLAT gmail DOT com if you don't want it posted to the board.

    ETA: I think I know what is happening with the SQL statement. Would you mind emailing me your plog-functions.php file and I'll edit it and send it back to you? It may be better than posting all the changes to the board. If it works, I'll make the changes to the current code as well to keep the galleries running quickly. Thanks for catching this!
    • CommentAuthorAndromeda
    • CommentTimeMar 20th 2009
     
    Thank you sidtheduck!

    You really resolved my problem very fast :)

    I love you and I love plogger too !!!
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 21st 2009
     
    Glad I could be of help, Andromeda! And thank you for reporting the issue you were having as well. It helps us squash the bugs of Plogger when we know what they are! :D