checking title of next image

Hi,

i want to check in a loop of album.php of the default template what the title of the next image is. This is because sometimes i have front and back pictures of one item (i mention front/back in the title).

This is the loop and i tried a couple of things but i always failed to find a proper solution.

[code]

while (next_image(false, $firstPageImages)):
$desc= getImageDesc();
// hide big pictures when not logged in...
if (zp_loggedin()){
$output.= "<div class='imagethumb'><img src='".getImageThumb(getImageTitle())."'></div>\n";
}else{
$output.= "<div class='imagethumb'><img src='".getImageThumb(getImageTitle())."'></div>\n";
}
$output.= "</div>";
$last_image=getImageThumb(getImageTitle());
endwhile;

[/code]

regards Volkan

Comments

  • A simpler way of doing this is to add the information you want to print in the custom_data field of the image. Then you can just display it.

    `$custom = $_zp_current_image->getCustomData();` will return what you put in that field in ADMIN.
  • Hi sbillard,

    thanks i will use the custom data field but i want to display the front and back images next to each other. Thats why i need to know if the next image is the back of an item so that i can output different html.

    it must be something like this but i don't know how to access information of the next image.

    [code]
    `

    //next image

    if ($_zp_NEXT_image->getCustomData()=='back'){

    // don't close the div

    echo "
    imagen";

    }elseif ($_zp_current_image->getCustomData()==back){

    //close the div containing two images

    echo "image
    ";

    }else{

    //standard one image div having no back image

    echo "
    image
    n";

    }

    `
    [/code]

    If you know an easier solution i would be gratefull to hear it...

    regards Volkan
  • acrylian Administrator, Developer
    If you name your images, the file names, properly, you could use `getNextImageURL()` to extract the filename and check on that.
  • trisweb Administrator
    To get the next image is easy, it's built in to the image class:

    `$nextimage = $_zp_current_image->getNextImage()

    if ($nextimage->getCustomData()=='back') {

    ...`
  • If someone has similar problem. This was the solution:

    `

    while (next_image(false, $firstPageImages)):

    $desc= getImageDesc();

    $output.= "
    ";

    $output.= "

    description:
    ".$desc."

    n";

    // hide big pictures when not logged in...

    if (zp_loggedin()){

    $output.= "

    imagen";

    }else{

    $output.= "
    imagen";

    }

    if (strpos(getNextImageURL(),"back")!=''){

    next_image(false, $firstPageImages);

    if (zp_loggedin()){

    $output.="image";

    }else{

    $output.="image";

    }

    }

    $output.= "
    ";

    $last_image=getImageThumb(getImageTitle());

    endwhile;

    `

    gr volkan
Sign In or Register to comment.