I have tried to find a way to add a tag that is not stored when the image is discovered and doesn't have a tick for in the options but I can't seem to. Is there a way (without changing core files) to do this? The tag info (Software 0131) gets parsed but not saved in the DB.
Currently I am calling read_exif_data_protected($_zp_current_image->localpath) on my image page and then pulling out the Software tag if the Make tag is Hipstamatic greater than Model 252. The Software tag contains info on the processing that was done when the photo was taken. Then I just strip the three items out and format them for display.
It just seems like I am taking the long way around. If anyone could point me in the right direction that would be great.
Thanks.
Comments
I'm using version 1.4.2.2 [9365]. With a very modified version of zpMinimal. Yeah, I was getting ready to upgrade soon, I guess I will have to give it a go on my test server. I just wanted to be sure I wasn't missing something easier (on the theme side) to avoid re-parsing something that was already parsed.
This is a two-fold issue. First the exifier code has to process the tag. That seems the case for 0131--it is an IFDO tag. Second the `exifvars` array in functions.php needs to have an entry for the tag. This is probably all that is missing for the `software` tag.
probably adding the following line would do the trick:
`'EXIFSoftware' => array('IFD0', 'Software',gettext('SOftware'), true, 999, true),`
Let us know if it works, we can add it to the next release.
Reading through the comments (in functions.php) it did seem adding that tag in functions.php and running setup would do the trick. I just didn't want to change anything at the core level especially something that would change the DB. I guess right after the EXIFFocalLengthIn35mmFilm might be a good place for it.
The direction is much appreciated. I will let you know how it goes and open a ticket after so it is not forgotten.
At the moment I am successfully running 5.3.10. When it does fail, simply adding lines of code to try to figure out why it fails makes it work again. I kind of think it must have to do with file sizes or some such strange thing.
Added to functions.php at line 2322,
`
'EXIFSoftware' => array('IFD0', 'Software', gettext('Software'), true, 999, true),
`
(tabs and whitespace removed to protect sanity...)
Then I ran setup and refreshed the metadata for a small album. Everything worked well. The new tag shows up in the image options and works as it should.
Since I did want to process the info from the tag further I selected it as "hidden" then got at the info using,
`
$exif_tags = getImageMetaData($_zp_current_image,false);
`
so I could get at the three tags I was interested in for the DB instead of the image. Then I processed the EXIFSoftware tag to get at the three items stored in it and display them individually. The only thing that would be nice if there were a function in template-functions.php that would allow to retrieve only a specific tag (or array of tags). Something like getImageMetaItem($image,$tagname). I suppose I could just hand roll a new printImageMetadata() that did what I wanted and put it in my theme functions.php file as well.
I think I have to create a new account to open a ticket for this. The last time I tried it seemed my old one perhaps got purged.
Anyway, thanks for the ideas. I now have a nice little display of what processing (lens, film and flash) that my Hipstamatic images were shot at. The final result can be seen here. http://www.sowearedads.com/snaps5/IMG_8940.JPG.php
Enjoy the weekend...
You do not need the `getImageMetadata()` call in general as the metadata will be automatically loaded. But since this is a new field you would need to use the admin refresh metadata button to get it loaded in the first place.
You can skip the ticket. I will add the code for the 1.4.4 release. Thanks for the testing. Probably I will default it to hidden since that seems what you wanted in the first place.