ZenphotoCMS Forum
How to get the width of an image in image.php - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Themes (https://forum.zenphoto.org/forum-5.html)
+--- Thread: How to get the width of an image in image.php (/thread-2851.html)



How to get the width of an image in image.php - philsblogging - 2008-05-11

Hello fellow-zenphoto users!

I have a question that has been making me really go nuts because of my blog redesign and thus I changed my theme accordingly!
My question (for design matters): I want to know the width of an image displayed in the image.php file. I haven't been able to figure this out, so maybe you can help me out with this.

I tried but it's not working. Since the width can change, let's assume you entered a 640 px max width in the administration panel and you upload a 400 px file, it still gets displayed width 400px... SO, is there a remedy for this?

Cu philipp




How to get the width of an image in image.php - acrylian - 2008-05-11

The correct usage for getWidth() would be $_zp_current_image->getWidth() since it's a object/class function.

But we have several other functions
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functiongetDefaultWidth
http://www.zenphoto.org/documentation-official/zenphoto/_template-functions.php.html#functiongetFullWidth
These can be used directly.




How to get the width of an image in image.php - philsblogging - 2008-05-11

Thank you very much. That helped a lot.
CU Philipp

The gallery now looks like I intended it in first place.
http://philsblogging.com/gallery/