Error random image from dynamic album

fretzl Administrator, Developer
Zenphoto 1.2.2 [3131] - default theme.

I am using getRandomImagesAlbum() on my index.php.

When I set the function to choose from a dynamic album I get this error:

`Fatal error: Call to a member function getSearchEngine() on a non-object in path-to-zenphoto\zenphoto\zp-core\template-functions.php on line 2920`

It works fine with all the other "normal" albums.

Any ideas ?

Comments

  • It seems to be working in the Efferevescence+ theme. Maybe we need more information. The error you are getting indicates that the "album" was not an object. So how was `getRandomImagesAlbum()` called? Any parameters? If no parameters were passed it is an indication that `$_zp_current_album` is not setup. If you did pass a parameter, then there is something wrong with that parameter.
  • fretzl Administrator, Developer
    Thanks for your reply.

    This is what I have:

    `
    <?php if ((getOption('Randomimage')== '--Gallery--')) {
    makeImageCurrent(getRandomImages(false));
    printCustomSizedImageMaxSpace($alt='',600,600,NULL,NULL, false); }
    // displays a random image from the entire gallery
    else {
    makeImageCurrent(getRandomImagesAlbum(getOption('Randomimage')))
    printCustomSizedImageMaxSpace('',600,600,NULL,NULL, false);} ?>
    //displays a random image from any other chosen album
    `
    Probably all wrong but maybe you can help me out.

    Thanks
  • fretzl Administrator, Developer
    ...and the passed parameter is the name of the dynamic album: `series.alb`
  • Ok, Got it. The code in getRandomImagesAlbum that reads:
    `
    if ($album->isDynamic()) {
    $search = $_zp_current_album->getSearchEngine();
    $images = $search->getImages(0);
    `
    needs instead to say
    `
    if ($album->isDynamic()) {
    $search = $album->getSearchEngine();
    $images = $search->getImages(0);
    `
  • fretzl Administrator, Developer
    Works! Thanks again sbillard.
Sign In or Register to comment.