EXIF data: showing lens model info EXIF data: showing lens model info
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

EXIF data: showing lens model info

Started by wuschel_lux, November 17, 2014, 11:16:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wuschel_lux

Hi all,

I'am searching for a solution for my actual gallery. I want to display some EXIF data below the photo. I also started this and I am quite happy with the result. Just the lens info is missing for me.
In the documentation I found the hint to look for example the file /include/markers/canon.php.
Now it would be great to use "case "0095": $tag = "LensInfo";break;".

In the forum I found following article: http://forum.coppermine-gallery.net/index.php?topic=59103.0 But I cant follow all the code replacements in the actual version 1.5.34.

Is there anybody out the, who can give me a hint how to integrate the lens info in the EXIF string I use in my template?

here a small extract of my theme.php:
      // EXIF String on Image page
if ($exif_string != '' && $exif[$lang_picinfo['Model']] !='') {
$exif[$lang_picinfo['FocalLength']] . ', ' . $exif[$lang_picinfo['FNumber']] . ', ' . $exif[$lang_picinfo['ExposureTime']] . ', ISO '. $exif[$lang_picinfo['ISOSpeedRatings']] .', '. $exif[$lang_picinfo['Flash']] .')';
}
else $exif_string = ' not indicated';

.....

                                          <tr>
                                            <td class="tableh1">
                                          <strong>Photo details:</strong>
                                        </td>
                                          </tr>
                                          <tr>
                                            <td>
                                          photo by: <i>{USER}</i>
                                        </td>
                                          </tr>
                                          <tr>
                                            <td>
                                          Hits: <i>{IMAGEHITS}</i>
                                        </td>
                                          </tr> 
                                            <tr>
                                            <td>
                                          Equipment: <i>{EXIF_STRING}</i>
                                        </td>
                                          </tr>
                                          <tr>
                                            <td>
                                          Keywords: <i>{KEYWORDS}</i>
                                          <br /><br />
                                        </td>
                                          </tr>



Live site preview: http://www.volleyball.lu/fotogallery/displayimage.php?album=708&pid=50672#top_display_media

actual line: Equipment: Canon EOS 7D (Manual, 115 mm, f/2.8, 1/640 sec, ISO 6400, No Flash)
expected line: Equipment: Canon EOS 7D / Canon EF 70-200mm F2.8L IS (Manual, 115 mm, f/2.8, 1/640 sec, ISO 6400, No Flash)

Thanks a lot in advance.

Αndré

Please attach a test picture with the corresponding EXIF data, so we can test ourselves.

wuschel_lux

Hi André,
I am so sorry for the late reply, but I didn't got the notification of a reply.

This is the link to my gallery for a sample photo:
http://www.volleyball.lu/fotogallery/displayimage.php?album=713&pid=51062#top_display_media

As Attachment the requested photo with full EXIF info. The second pic, is a screenshot from Lightroom with EXIF info.

Hope this could help you.

Thank's a lot.

Αndré

As you seem to embed the EXIF info with some custom code to your gallery, this is maybe a very short and easy mod. Please try the following.

Open include/exif_php.inc.php, find
$exif_names = explode("|", $exif_info);
and above, add
$exif_info .= "|LensInfo";

This will read the lens info and stores it in the MySQL table (so you maybe have to clear the EXIF table if the info isn't displayed for existing pictures, but new ones). The output in a default gallery currently looks like at the attached screenshot.

wuschel_lux

thanks André, for your help.

I just added the code to the mentioned file. For new files (e.g. http://www.volleyball.lu/fotogallery/displayimage.php?album=725&pid=51815#top_display_media) I can find the LensInfo in the MySQL table

........ "ExposureMode";i:1;s:12:"WhiteBalance";i:0;s:16:"SceneCaptureMode";i:0;s:8:"LensInfo";s:27:"EF70-200mm f/2.8L IS II USM";}

but there is no output to the picture info like in your test gallery. Please see attachment.



Αndré

Quote from: wuschel_lux on November 17, 2014, 11:16:52 AM
actual line: Equipment: Canon EOS 7D (Manual, 115 mm, f/2.8, 1/640 sec, ISO 6400, No Flash)
expected line: Equipment: Canon EOS 7D / Canon EF 70-200mm F2.8L IS (Manual, 115 mm, f/2.8, 1/640 sec, ISO 6400, No Flash)

If this is what you want to have as result, I suggest to skip what Coppermine displays by default. Instead, we should adjust your custom code. However, I assume the code you posted won't work, as this actually doesn't anything:
if ($exif_string != '' && $exif[$lang_picinfo['Model']] !='') {
$exif[$lang_picinfo['FocalLength']] . ', ' . $exif[$lang_picinfo['FNumber']] . ', ' . $exif[$lang_picinfo['ExposureTime']] . ', ISO '. $exif[$lang_picinfo['ISOSpeedRatings']] .', '. $exif[$lang_picinfo['Flash']] .')';
}


Do you already have working code for your actual line? If so, please post it, so we can add the lens info to that line.

wuschel_lux

you are right with your "expected line".

Here my working code in theme.php:
if ($exif_string != '' && $exif[$lang_picinfo['Model']] !='') {
// EXIF String on Image page
$exif_string = $exif[$lang_picinfo['Model']] . ' ('. $exif[$lang_picinfo['ExposureProgram']] .', ' . $exif[$lang_picinfo['FocalLength']] . ', ' . $exif[$lang_picinfo['FNumber']] . ', ' . $exif[$lang_picinfo['ExposureTime']] . ', ISO '. $exif[$lang_picinfo['ISOSpeedRatings']] .', '. $exif[$lang_picinfo['Flash']] .')';

tryed to add someting like this for the lens info:
$exif[$lang_picinfo['LensInfo']] or $exif['LensInfo']
but without success. No output.

wuschel_lux

here the complete code in theme.php for reading the EXIF data:
  // read exif data
    if ($CONFIG['read_exif_data']) {
        $path_to_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CURRENT_PIC_DATA['filename'];
        $path_to_orig_pic = $CONFIG['fullpath'] . $CURRENT_PIC_DATA['filepath'] . $CONFIG['orig_pfx'] . $CURRENT_PIC_DATA['filename'];
        $metadata_path = file_exists($path_to_orig_pic) ? $path_to_orig_pic : $path_to_pic;
        $exif = exif_parse_file($metadata_path, $CURRENT_PIC_DATA['pid']);
        if (is_array($exif)) {
            array_walk($exif, 'sanitize_data');
        }
        print_r($exif);
       
    $exif_bracket_array = array('Focal length', 'FNumber', 'Exposure Time', 'Model',);
$exif_string = '';
foreach ($exif_bracket_array as $key) {
$exif_string .= $exif[$key] . ', ';
}
$exif_string = rtrim($exif_string);
$exif_string = rtrim($exif_string, ',');
//print_r($exif_string);
if ($exif_string != '' && $exif[$lang_picinfo['Model']] !='') {
// EXIF String on Image page
$exif_string = $exif[$lang_picinfo['Model']] .' - '. $exif['LensInfo']. ' ('. $exif[$lang_picinfo['ExposureProgram']] .', ' . $exif[$lang_picinfo['FocalLength']] . ', ' . $exif[$lang_picinfo['FNumber']] . ', ' . $exif[$lang_picinfo['ExposureTime']] . ', ISO '. $exif[$lang_picinfo['ISOSpeedRatings']] .', '. $exif[$lang_picinfo['Flash']] .')';
}
else $exif_string = ' not indicated';
//print_r($exif_string); //Test output string
    }


the print_r returns the following array:
Array ( [Colour Space] => sRGB [DateTime Original] => 2015:01:02 20:13:59 [Exposure Program] => Manual [Exposure Time] => 1/800 sec [FNumber] => f/2.8 [Flash] => No Flash [Focal length] => 135 mm [ISO] => 6400 [Make] => Canon [Metering Mode] => Pattern [Model] => Canon EOS 7D )
so the LensInfo is not included.

Αndré

That's because exif_parse_file strips the EXIF data, which has not been enabled in the EXIF manager:
    $exifCurrentData = array_keys(array_filter(explode("|", $CONFIG['show_which_exif'])));

    foreach ($exifCurrentData as $i) {
        $name = $exif_names[$i];
        if (isset($exif[$name])) {
            $exifParsed[$lang_picinfo[$name]] = $exif[$name];
        }
    }



To fix this, open lang/english.php and add
$lang_picinfo['LensInfo'] = 'Lense info';
before the closing PHP tag
?>

Additionally, open exifmgr.php, find
$exifRawData = explode("|", $exif_info);
and above, add
$exif_info .= "|LensInfo";


Now, open the EXIF manager and enable the lens info row.

wuschel_lux

many thank's André for giving me the missing piece for my puzzle.

Now it works fine for me.