forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: macmiller on December 24, 2006, 08:02:51 am

Title: Exif Data - When is it populated in the CPG1410_Exif table
Post by: macmiller on December 24, 2006, 08:02:51 am
Just getting started using coppermine.  I needed to write a script which uses exif data (the data that is camera dependent that you can see when you view info on a picture).  After getting my pictures separated into various albums I was surprised to find I had 195 picture records and only 38 exif records.  Why was some of the exif data not getting correctly populated?

I did a lookup on exif and saw some users had had previous problems with exif data, and therefore began to get discouraged.

But then what I found was that the exif data table is not populated when you upload the image, it is only populated when you do the initial view info on the image (correct me if I'm wrong).

So-- if you want to have an external script access the Exif data you must manually view info on each image first.  Is there any way to have the Exif data populated during the batch upload?  Is there a reason why it is only populated when the image is viewed?

This is more or less just a note because I think this kind of wierd and that others might be have been thrown off by it also. 
Title: Re: Exif Data - When is it populated in the CPG1410_Exif table
Post by: Nibbler on December 24, 2006, 08:01:23 pm
It reads in IPTC data on upload but EXIF only when viewed. I don't know why - might be an oversight.

include/picmgmt.inc.php

Code: [Select]
        if ($CONFIG['read_iptc_data']) {
           $iptc = get_IPTC($image);
           if (is_array($iptc) && !$title && !$caption && !$keywords) {  //if any of those 3 are filled out we don't want to override them, they may be blank on purpose.
               $title = (isset($iptc['Title'])) ? $iptc['Title'] : $title;
               $caption = (isset($iptc['Caption'])) ? $iptc['Caption'] : $caption;
               $keywords = (isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']) : $keywords;
           }
        }

Add in code to read EXIF after here

Code: [Select]
if ($CONFIG['read_exif_data']) exif_parse_file($image);