Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

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

    • CommentAuthormista3
    • CommentTimeApr 3rd 2006 edited
     permalink
    Hi folks,

    I've asked multiple times on the Zenphoto forums about this, but with no answers yet, maybeb someone else on here uses Zenphoto and can help me out?

    I found some code to spit out a random image from my ZP database... want I'd love to do is modifying to give something more like a Flickr badge - 4 or 6 random square thumbnails.... but my php isn't up to it...

    Cheers

    3stripe

    <!-- small random image -->
    <?php
    require_once 'portfolio/zen/classes.php';
    $zpimagesize = isset($_GET['s']) ? $_GET['s'] : 180;
    for ($i = 0; $i < 1; $i++)
    {
    $randomImage = getRandomImage();
    $imageLinkURL = getImageLinkURL($randomImage);
    $imagesrc = $randomImage->getSizedImage($zpimagesize);
    $imagesrc = substr($imagesrc, 1);
    $imagesrc = "http://www.******.com/portfolio" . $imagesrc;
    print '<a href="http:' . $imageLinkURL . ' alt=" '
    . $randomImage->getTitle() . '">'
    . '<img src="' . $imagesrc . '" class="mainimage"'
    . 'alt="' . $randomImage->getTitle() . '"></a><br />';
    }
    function getRandomImage()
    {
    global $_zp_current_image;
    if(db_connect())
    {
    $random=query_single_row('SELECT zpimages.filename,
    zpimages.title, zpalbums.folder
    FROM zpimages
    INNER JOIN zpalbums
    ON zpimages.albumid = zpalbums.id
    ORDER BY RAND() LIMIT 1');
    $image = new Image(
    new Album(new Gallery(), $random['folder']),
    $random['filename']);
    return $image;
    }
    else
    {
    return false;
    }
    }
    function getImageLinkURL($image)
    {
    return WEBPATH . "/www.******.com/portfolio/"
    . urlencode($image->getAlbumName())
    . "/" . urlencode($image->name);
    }
    ?>
    • CommentAuthormista3
    • CommentTimeApr 5th 2006
     permalink
    No other zenphoto users here then?
Add your comments
    Username Password
  • Format comments as (Help)