How i get the a album thumb with just passing the name of the album?

Hello everybody,
i would like to know if exists a function which give me the album thumb for a determinate name album.
Thank you in advance. If doesn't exist some suggestion are perfect.

Comments

  • acrylian Administrator, Developer
    http://www.zenphoto.org/documentation/classes/Album.html#methodgetAlbumThumbImage
    Note this is a album class method which means you have to create an album object of the album to get the thumb from first.
  • so should i create a album object with the "Constructor for albums" and then pass it to getAlbumThumbImage() method??
  • acrylian Administrator, Developer
    Exactly.
  • thank you!!
  • i can't make it work, i get this error "Fatal error: Call to undefined function Album() "
    My code is:

    <?php $album=Album(getParent(),dfm091024divinae,TRUE) ?>
    <?php getAlbumThumbImage($album) ?>

    Some suggestion, i guess i'm writing something wrong in the Album function but i can't understand what...
  • acrylian Administrator, Developer
    Well, you need to learn the php basics of working object orientated. There are also some typos:

    `<?php $album= new Album($_zp_gallery,"dfm091024divinae",TRUE); ?>`

    The parent gallery to be passed as the first parameter means the gallery object which is stored in `$_zp_gallery` on the theme pages. It is NOT the parent album! In Zenphoto terms the term "gallery" refers Zenphoto in total, not to an album (see the glossary, too). Note: If you trying to create an object from a subalbum you need to pass the full name with the parent folder like `toplevelalbumname/subalbumname` since you can have albums of the same name within different albums.

    Also `getAlbumThumbImage($album)` does nothing. You have either to do `$thumbimage = getAlbumThumbImage($album)`, then echo the variable or `echo getAlbumThumbImage($album)`. Note that if no album thumb is set this function returns an image object.
  • really thank you!Amazing help from the support!
  • This is the way i solved:

    `

    <?php $album = new Album($_zp_gallery,"dfm091024divinae",TRUE);?>

    image<?php echo $album->getAlbumThumb() ?>" alt="<?php echo $album->getTitle() ?>" />

    `
Sign In or Register to comment.