Member
Member
bryanbrazil   2010-01-03, 22:36
#1

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!

Member
Member
sbillard   2010-01-03, 23:31
#2

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.

Member
Member
bryanbrazil   2010-01-04, 01:33
#3

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.');

}

`

Member
Member
bryanbrazil   2010-01-04, 01:42
#4

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

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

Administrator
Administrator
acrylian   2010-01-04, 10:47
#5

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

Member
Member
bryanbrazil   2010-01-04, 23:29
#6

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?

Member
Member
sbillard   2010-01-05, 02:45
#7

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.

Member
Member
bryanbrazil   2010-01-05, 09:22
#8

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

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.