ZenphotoCMS Forum
Get Images using Image ID - 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: Get Images using Image ID (/thread-5428.html)



Get Images using Image ID - quiraang - 03-07-2009

I've tried searching the forum but can't find anything similar.

I have additional MySQL tables which hold order related information. I need to relate this to an image so I store the image ID from the ZP images table.

On an Order page I also need to display the image thumb and/or a custom size image, but I can't work out how to get back the images using ZP template functions when starting from the image ID. It's probably really obvious but I can't see it.




Get Images using Image ID - acrylian - 03-07-2009

For this you need also the file name of the image. Also you need to get the album name of the album the image belongs to. Then you have to create an albumobject using new Album():
http://www.zenphoto.org/documentation/classes/Album.html#methodAlbum

With that you then need to create an image object using newImage().
http://www.zenphoto.org/documentation/classes/_class-image.php.html#functionnewImage

Now you can use the image class methodes to get the thumb, custom images etc.
http://www.zenphoto.org/documentation/classes/_Image.html

Of course on that page if it is not a Zenphoto theme page you need to have the Zenphoto functions available, for example this way:
http://www.zenphoto.org/2008/01/hacks/#zenphoto-as-plugin




Get Images using Image ID - quiraang - 03-07-2009

Terrific! Thanks for the help