ZenphotoCMS Forum
checking title of next image - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: checking title of next image (/thread-2330.html)



checking title of next image - MuschPusch - 2008-03-04

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.= "\n";
}else{
$output.= "\n";
}
$output.= "";
$last_image=getImageThumb(getImageTitle());
endwhile;

[/code]

regards Volkan




checking title of next image - sbillard - 2008-03-04

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.




checking title of next image - MuschPusch - 2008-03-05

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 "n";

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

//close the div containing two images

echo "";

}else{

//standard one image div having no back image

echo "n";

}

`
[/code]

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

regards Volkan




checking title of next image - acrylian - 2008-03-05

If you name your images, the file names, properly, you could use getNextImageURL() to extract the filename and check on that.




checking title of next image - trisweb - 2008-03-05

To get the next image is easy, it's built in to the image class:

`$nextimage = $_zp_current_image->getNextImage()

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

...`




checking title of next image - MuschPusch - 2008-03-15

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.= "n";

                }else{

                    $output.= "n";

                }

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

        next_image(false, $firstPageImages);

                    if (zp_loggedin()){

            $output.="";

        }else{

            $output.="";

        }

                }

                $output.= "";

                $last_image=getImageThumb(getImageTitle());

            endwhile;

`

gr volkan