Not signed in (Sign In)

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

Please sign in or apply for membership to remove the ads
    • CommentAuthorLeGaS
    • CommentTimeJun 19th 2008
     
    Hello!

    I would like to display 3 or 4 pictures next to or more likely under the name of an album, but I couldn't found any function for this.
    Could you help me please?

    Thanks!
    • CommentAuthorLeGaS
    • CommentTimeJun 22nd 2008
     
    Anybody?
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 22nd 2008
     
    LeGas,

    How would you choose the 3 or 4 images? Is it the most recent ones? Random images? The top alphabetical, bottom alphabetical? If you let us know that, I can try to help you create a MySQL query that will pull them in for you.
    • CommentAuthorpandianbe
    • CommentTimeJun 22nd 2008
     
    Hi sidtheduck,

    It would be latest 4 images or any random 4 images from the each album.what is the function ?where can we change the SQL Query?

    Thanks :-)
    • CommentAuthorLeGaS
    • CommentTimeJun 23rd 2008
     
    Hello sidtheduck,

    It doesn't matter, it's ok for me if those pictures are selected randomly.
    Thanks for your help! :)
    •  
      CommentAuthorsidtheduck
    • CommentTimeJul 3rd 2008 edited
     
    I finally got around to this, sorry for the long wait. My example is using the 'default / classic' theme and it grabs the 4 newest image from the collection.

    Open 'collections.php' and find the following code:// generate XHTML with thumbnail and link to picture view.
    print '<img class="photos" src="'.plogger_get_collection_thumb().'" title="'.$desc.'" alt="'.$desc.'" />';
    and change it to read:// generate XHTML with thumbnail and link to picture view.
    $thumb_query = "SELECT * FROM `".TABLE_PREFIX."pictures` WHERE `parent_collection`='".plogger_get_collection_id()."' ORDER BY `id` DESC LIMIT 4";
    $thumb_result = run_query($thumb_query);
    while($thumb_data = mysql_fetch_assoc($thumb_result)){
    print '<img class="photos" src="'.generate_thumb($thumb_data['path'], $thumb_data['id'], THUMB_SMALL).'" title="'.$desc.'" alt="'.$desc.'"/>';;
    }


    If you want random images, just change your $thumb_query to:$thumb_query = "SELECT * FROM `".TABLE_PREFIX."pictures` WHERE `parent_collection`='".plogger_get_collection_id()."' ORDER BY RAND() LIMIT 4";