Showing lens model from EXIF Showing lens model from EXIF
 

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

Showing lens model from EXIF

Started by parabola, April 20, 2009, 08:20:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

parabola

I'm sure I'm not the only one who wants that but I just can't find a thread for that... Is that possible to show the type of the lens from the EXIF in Coppermine?

I mostly posts photos taken with Canon. In DPP, it shows the lens type, such as "EF-S17-55mm f/2.8 IS USM". According to this page:

http://gvsoft.homedns.org/exif/lens-type.html

There should be a mapping between for lens type. Is there an easy way to implement this in Coppermine? Or has anyone already done this?  ???

Thanks!

Joachim Müller

I don't think that the lense type exif data is being taken into account. Coppermine is only using some exif records, not all of them. We rely on the usage of an exif library.

Nibbler

I was able to add support for this to the library. The instructions are quite long however.

edit include/makers/cannon.php

Find

$result['Unknown']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//22

Change to


                        $result['LensType']=hexdec(intel2Moto(substr($data,$place,4)));$place+=4;//22

                                if($result['LensType']==1) $result['LensType'] = "Canon EF 50mm f/1.8";
                                if($result['LensType']==2) $result['LensType'] = "Canon EF 28mm f/2.8";
                                if($result['LensType']==3) $result['LensType'] = "Canon EF 135mm F2.8 Soft";
                                if($result['LensType']==4) $result['LensType'] = "Sigma UC Zoom 35-135mm f/4-5.6";
                                if($result['LensType']==6) $result['LensType'] = "Tokina AF193-2 19-35mm f/3.5-4.5";
                                if($result['LensType']==10) $result['LensType'] = "Sigma 50mm f/2.8 EX / 28mm f/1.8";
                                if($result['LensType']==11) $result['LensType'] = "Canon EF 35mm f/2";
                                if($result['LensType']==13) $result['LensType'] = "Canon EF 15mm f/2.8";
                                if($result['LensType']==21) $result['LensType'] = "Canon EF 80-200mm f/2.8L";
                                if($result['LensType']==26) $result['LensType'] = "Cosina 100mm f/3.5 Macro AF";
                                if($result['LensType']==28) $result['LensType'] = "Tamron AF Aspherical 28-200mm f/3.8-5.6";
                                if($result['LensType']==29) $result['LensType'] = "Canon EF 50mm f/1.8 MkII";
                                if($result['LensType']==32) $result['LensType'] = "Sigma 15mm F2.8 DIAGONAL FISHEYE";
                                if($result['LensType']==39) $result['LensType'] = "Canon EF 75-300mm f/4-5.6";
                                if($result['LensType']==40) $result['LensType'] = "Canon EF 28-80mm f/3.5-5.6";
                                if($result['LensType']==124) $result['LensType'] = "Canon MP-E 65mm f/2.8 1-5x Macro Photo";
                                if($result['LensType']==125) $result['LensType'] = "Canon TS-E 24mm f/3.5L";
                                if($result['LensType']==126) $result['LensType'] = "Canon TS 45mm F2.8";
                                if($result['LensType']==130) $result['LensType'] = "Canon EF 50mm F1.0L USM";
                                if($result['LensType']==131) $result['LensType'] = "Sigma 17-35mm f2.8-4 EX Aspherical HSM";
                                if($result['LensType']==135) $result['LensType'] = "Canon EF 200mm f/1.8L";
                                if($result['LensType']==136) $result['LensType'] = "Canon EF 300mm f/2.8L";
                                if($result['LensType']==137) $result['LensType'] = "Canon EF85mm F1.2L USM";
                                if($result['LensType']==139) $result['LensType'] = "Canon EF 400mm f/2.8L";
                                if($result['LensType']==141) $result['LensType'] = "Canon EF 500mm f/4.5L";
                                if($result['LensType']==142) $result['LensType'] = "Canon EF 300mm F2.8L IS";
                                if($result['LensType']==149) $result['LensType'] = "Canon EF 100mm f/2";
                                if($result['LensType']==150) $result['LensType'] = "Sigma 20mm EX f/1.8";
                                if($result['LensType']==151) $result['LensType'] = "Canon EF 200mm f/2.8L USM";
                                if($result['LensType']==153) $result['LensType'] = "Canon EF 35-350mm f/3.5-5.6L";
                                if($result['LensType']==155) $result['LensType'] = "Canon EF 85mm f/1.8 USM";
                                if($result['LensType']==156) $result['LensType'] = "Canon EF 28-105mm f/3.5-4.5 USM";
                                if($result['LensType']==160) $result['LensType'] = "Canon EF 20-35mm f/3.5-4.5 USM";
                                if($result['LensType']==161) $result['LensType'] = "Canon EF 28-70mm f/2.8mm L USM<br>or<br>Sigma 24-70mm EX f/2.8";
                                if($result['LensType']==165) $result['LensType'] = "Canon EF 70-200mm f/2.8 L";
                                if($result['LensType']==166) $result['LensType'] = "Canon EF 70-200mm f/2.8 L + x1.4";
                                if($result['LensType']==167) $result['LensType'] = "Canon EF 70-200mm f/2.8 L + x2";
                                if($result['LensType']==168) $result['LensType'] = "Canon EF 28mm F1.8 USM";
                                if($result['LensType']==169) $result['LensType'] = "Sigma 15-30mm f/3.5-4.5 EX DG Aspherical";
                                if($result['LensType']==170) $result['LensType'] = "Canon EF 200mm f/2.8L II";
                                if($result['LensType']==173) $result['LensType'] = "Sigma 180mm EX HSM Macro f/3.5";
                                if($result['LensType']==174) $result['LensType'] = "Canon EF 135mm f/2L";
                                if($result['LensType']==176) $result['LensType'] = "Canon EF 24-85mm f/3.5-4.5 USM";
                                if($result['LensType']==177) $result['LensType'] = "Canon EF 300mm f/4L IS";
                                if($result['LensType']==178) $result['LensType'] = "Canon EF 28-135mm f/3.5-5.6 IS";
                                if($result['LensType']==180) $result['LensType'] = "Canon EF 35mm f/1.4L";
                                if($result['LensType']==181) $result['LensType'] = "Canon EF 100-400mm F4.5-5.6L IS + 1.4x ";
                                if($result['LensType']==182) $result['LensType'] = "Canon EF 100-400mm f/4.5-5.6 L IS + x2";
                                if($result['LensType']==183) $result['LensType'] = "Canon EF 100-400mm f/4.5-5.6 L IS";
                                if($result['LensType']==184) $result['LensType'] = "Canon EF 400mm F2.8L x2";
                                if($result['LensType']==186) $result['LensType'] = "Canon EF 70-200mm f/4L";
                                if($result['LensType']==190) $result['LensType'] = "Canon EF 100mm f/2.8 Macro";
                                if($result['LensType']==191) $result['LensType'] = "Canon EF 400mm f/4 DO IS";
                                if($result['LensType']==197) $result['LensType'] = "Canon EF 75-300mm f/4-5.6 IS";
                                if($result['LensType']==198) $result['LensType'] = "Canon EF 50mm f/1.4";
                                if($result['LensType']==202) $result['LensType'] = "Canon EF 28-80 f/3.5-5.6 USM IV";
                                if($result['LensType']==213) $result['LensType'] = "Canon EF 90-300mm f/4.5-5.6";
                                if($result['LensType']==224) $result['LensType'] = "Canon EF 70-200mm F2.8L IS";
                                if($result['LensType']==226) $result['LensType'] = "Canon EF 70-200mm F2.8L IS x2";
                                if($result['LensType']==229) $result['LensType'] = "Canon EF 16-35mm f/2.8L";
                                if($result['LensType']==230) $result['LensType'] = "Canon EF 24-70mm f/2.8L";
                                if($result['LensType']==231) $result['LensType'] = "Canon EF 17-40mm f/4L";
                                if($result['LensType']==232) $result['LensType'] = "Canon EF 70-300mm F4.5-5.6 DO IS USM";


Edit include/exif_php.inc.php

Find


        //String containing all the available exif tags.
        $exif_info = "AFFocusPosition|Adapter|ColorMode|ColorSpace|ComponentsConfiguration|CompressedBitsPerPixel|Contrast|CustomerRender|DateTimeOriginal|DateTimedigitized|DigitalZoom|DigitalZoomRatio|ExifImageHeight|ExifImageWidth|ExifInteroperabilityOffset|ExifOffset|ExifVersion|ExposureBiasValue|ExposureMode|ExposureProgram|ExposureTime|FNumber|FileSource|Flash|FlashPixVersion|FlashSetting|FocalLength|FocusMode|GainControl|IFD1Offset|ISOSelection|ISOSetting|ISOSpeedRatings|ImageAdjustment|ImageDescription|ImageSharpening|LightSource|Make|ManualFocusDistance|MaxApertureValue|MeteringMode|Model|NoiseReduction|Orientation|Quality|ResolutionUnit|Saturation|SceneCaptureMode|SceneType|Sharpness|Software|WhiteBalance|YCbCrPositioning|xResolution|yResolution";


Change to


        //String containing all the available exif tags.
        $exif_info = "AFFocusPosition|Adapter|ColorMode|ColorSpace|ComponentsConfiguration|CompressedBitsPerPixel|Contrast|CustomerRender|DateTimeOriginal|DateTimedigitized|DigitalZoom|DigitalZoomRatio|ExifImageHeight|ExifImageWidth|ExifInteroperabilityOffset|ExifOffset|ExifVersion|ExposureBiasValue|ExposureMode|ExposureProgram|ExposureTime|FNumber|FileSource|Flash|FlashPixVersion|FlashSetting|FocalLength|FocusMode|GainControl|IFD1Offset|ISOSelection|ISOSetting|ISOSpeedRatings|ImageAdjustment|ImageDescription|ImageSharpening|LightSource|Make|ManualFocusDistance|MaxApertureValue|MeteringMode|Model|NoiseReduction|Orientation|Quality|ResolutionUnit|Saturation|SceneCaptureMode|SceneType|Sharpness|Software|WhiteBalance|YCbCrPositioning|xResolution|yResolution|LensType";


Find


        if (is_array($exifRawData['IFD0'])) {
          $exif = array_merge ($exif,$exifRawData['IFD0']);
        }
        if (is_array($exifRawData['SubIFD'])) {
          $exif = array_merge ($exif,$exifRawData['SubIFD']);
        }
        if (is_array($exifRawData['SubIFD']['MakerNote'])) {
          $exif = array_merge ($exif,$exifRawData['SubIFD']['MakerNote']);
        }


After that section, add this


        if (is_array($exifRawData['SubIFD']['MakerNote']['Settings 1'])) {
          $exif = array_merge ($exif,$exifRawData['SubIFD']['MakerNote']['Settings 1']);
        }


Find


        foreach ($exif as $key => $val) {
          if (strpos($showExifStr,"|".$key) && isset($val)){
                $exifParsed[$lang_picinfo[$key]] = $val;
                //$exifParsed[$key] = $val;
          }
        }


Change to


        foreach ($exif as $key => $val) {
          if (strpos($showExifStr,"|".$key) && isset($lang_picinfo[$key])){
                $exifParsed[$lang_picinfo[$key]] = $val;
                //$exifParsed[$key] = $val;
          }
        }


Edit lang/english.php

Find


'details' => 'Details', //cpg1.4


After that, add


  'LensType' => 'Lens type',


Edit exifmgr.php

Find


//String containing all the available exif tags.
$exif_info = "AFFocusPosition|Adapter|ColorMode|ColorSpace|ComponentsConfiguration|CompressedBitsPerPixel|Contrast|CustomerRender|DateTimeOriginal|DateTimedigitized|DigitalZoom|DigitalZoomRatio|ExifImageHeight|ExifImageWidth|ExifInteroperabilityOffset|ExifOffset|ExifVersion|ExposureBiasValue|ExposureMode|ExposureProgram|ExposureTime|FNumber|FileSource|Flash|FlashPixVersion|FlashSetting|FocalLength|FocusMode|GainControl|IFD1Offset|ISOSelection|ISOSetting|ISOSpeedRatings|ImageAdjustment|ImageDescription|ImageSharpening|LightSource|Make|ManualFocusDistance|MaxApertureValue|MeteringMode|Model|NoiseReduction|Orientation|Quality|ResolutionUnit|Saturation|SceneCaptureMode|SceneType|Sharpness|Software|WhiteBalance|YCbCrPositioning|xResolution|yResolution";


change to


//String containing all the available exif tags.
$exif_info = "AFFocusPosition|Adapter|ColorMode|ColorSpace|ComponentsConfiguration|CompressedBitsPerPixel|Contrast|CustomerRender|DateTimeOriginal|DateTimedigitized|DigitalZoom|DigitalZoomRatio|ExifImageHeight|ExifImageWidth|ExifInteroperabilityOffset|ExifOffset|ExifVersion|ExposureBiasValue|ExposureMode|ExposureProgram|ExposureTime|FNumber|FileSource|Flash|FlashPixVersion|FlashSetting|FocalLength|FocusMode|GainControl|IFD1Offset|ISOSelection|ISOSetting|ISOSpeedRatings|ImageAdjustment|ImageDescription|ImageSharpening|LightSource|Make|ManualFocusDistance|MaxApertureValue|MeteringMode|Model|NoiseReduction|Orientation|Quality|ResolutionUnit|Saturation|SceneCaptureMode|SceneType|Sharpness|Software|WhiteBalance|YCbCrPositioning|xResolution|yResolution|LensType";