ZenphotoCMS Forum
How is printImageMetadata() supposed to work? - 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: How is printImageMetadata() supposed to work? (/thread-6377.html)



How is printImageMetadata() supposed to work? - bryanbrazil - 2010-01-03

I've checked the forum and read the function description in the User Guide. I'm trying to figure out how to not display any of the exif titles for photos that don't have exif information.

I tried using the following code in my theme's image.php file:

printImageMetadata('', false, 'imagemetadata_inline', '', false, '', 'No EXIF information available.');

However, it displays the exif categories, Camera Model, etc, even when a photo doesn't have exif information. Using the function call above, shouldn't the function print "No EXIF information available" when a photo doesn't have exif information?

Or, is there another way to test if the exif info is blank?

Thanks!




How is printImageMetadata() supposed to work? - sbillard - 2010-01-03

getMetadata() will return false if there is no metadata in the image. It there is metadata it will return an array of that data which you could check to see if there is anything of interest.

Generally speaking, the printXXX functions will always output something, is if you wish sometimes not to have output you need to use the equivalent getXXX function to test first.




How is printImageMetadata() supposed to work? - bryanbrazil - 2010-01-04

Hmm, I'm using the following code, but it still prints exif fields even when the image says "None selected for display" under Metadata in the Zenphoto Admin.

`

if (getImageMetaData())

{

printImageMetadata('', false, 'imagemetadata_inline', '', false, '', 'No EXIF information available.');

}

`




How is printImageMetadata() supposed to work? - bryanbrazil - 2010-01-04

Ah, got it working using info in this thread regarding getMetadata()...

http://www.zenphoto.org/support/topic.php?id=4786#post-28148




How is printImageMetadata() supposed to work? - acrylian - 2010-01-04

Well, sbillard already mentioned getMetaData() above...;-)




How is printImageMetadata() supposed to work? - bryanbrazil - 2010-01-04

Yes he did. :-) I had a hard time finding a list of the exif field names though...is that located in the user guide somewhere?




How is printImageMetadata() supposed to work? - sbillard - 2010-01-05

There is no 'static' list. The list is based on the $_zp_exifvars array at the front of functions.php. What gets shown by printImageMetadata() is based on the 'display' element of each metadata field. That field defaults to the value in $_zp_exifvars, but is changable via the options tabs.

So, if you want to know if any exif data will be displayed you have to test each element with display set to true and see if it is not empty.




How is printImageMetadata() supposed to work? - bryanbrazil - 2010-01-05

Thanks for pointing out functions.php, that's the list of array elements I was looking for!