Not signed in (Sign In)

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

    • CommentAuthorIke
    • CommentTimeNov 13th 2009

    I recently upgraded to the RC1 from beta 3. The old site had been modified to show a random picture of the albem/collection as it's thumbnail (changes on each load). To do this I had modified one of the files of plogger using an article on the forum as a guid.
    Unfortunately I've lost the way to do this..... Can you make it possible to choose random pic an option when choosing the album thumbnail? Automatic chooses one, but doesn't change on each load....

    Kind regards,
    • CommentAuthorIke
    • CommentTimeNov 13th 2009 edited
    Found my own awnser:

    I did a comparison between the original files from beta 3 and the ones on my server.
    Only one file was different: plog-functions.php
    With some efford I found the file in the RC1 instaal and made the same edit. It
    seems to work, but the server is very slow... No idea if this is becouse of the
    edit ot not.

    Kind regards,

    Random album cover edit (collection edit is near identical):

    function plogger_get_album_thumb() {
    $rv = $GLOBALS["current_album"];
    // figure out the thumbnail as well
    $thumb_query = "SELECT * FROM `".TABLE_PREFIX."pictures` WHERE ";
    if ($rv["thumbnail_id"] > 0)
    $thumb_query .= " `id`=".$rv["thumbnail_id"];
    $thumb_query .= " `parent_album`='".$rv["id"]."' ORDER BY `date_submitted` RAND() DESC LIMIT 1";

    $thumb_result = run_query($thumb_query);
    $thumb_data = mysql_fetch_assoc($thumb_result);
    if ($thumb_data) {
    $rv["thumbnail_id"] = $thumb_data["id"];
    $rv["thumbnail_path"] = $thumb_data["path"];
    return generate_thumb($rv['thumbnail_path'], $rv['thumbnail_id'], THUMB_SMALL);
    • CommentTimeNov 13th 2009

    Glad that you found it and got it working. I'll see what I can do to make this an option in future releases.

    If you want to test if your edit is causing the slowdown, you can edit the function back and test. However, my guess for the slowness is that Plogger is regenerating all of your thumbnails on the fly since the upgrade (although it should have regenerated the small thumbnails during the upgrade process). If it's always selecting a random thumbnail, it may always be generating a new thumbnail (if it hasn't been created already) before displaying the thumbnail for the album cover. To regenerate all of your thumbnails, just navigate your browser to all of your albums (and each page on the albums) and it should regenerate your thumbnails for you.

    I'm hoping to have a "Clear Cache" and/or "Generate Thumbnails" options in the Admin section as well if you want to force the regeneration of all thumbnails in a future release (but it's still being worked on).