PDA

View Full Version : LensInfo/LensType for Nikon D50 discovered


zolotoiy
10-12-2006, 03:06 PM
I saw many people were asking here about including lens information in their blogs but that data was not available in stardard tags, so I digged in into Exifer code a bit and found that while that data is retrieved it is not correctly processed. Beware, this is my first take on PHP, so be kind :).
This requires modification of Exifer code - I'm not sure about procedures because original developer closed this project almost 2 years ago.
Problems were in unnecessary byte order convertion and too generic handling of data. LensInfo f.e. contains 4 rational numbers while only one was processed in original code.

So here it goes:
Replace your file /includes/exifer1_5/makers/nikon.php with this one (http://x-processed.ca/samplepics/nikon.rar).
Install ExtraExif addon, add following code to it:


$lens = $exif_result['SubIFD']['MakerNote']['LensInfo'];
if( isset( $lens ) && $lens != "" )
$lens .= " ".$exif_result['SubIFD']['MakerNote']['LensType'];
$tpl = str_replace("<EXIF_COMPAT_LENS>",$lens,$tpl);
if($lens != "")
{
$lens = "Lens: $lens";
$tpl = str_replace("<LANG_COMPAT_LENS>",$lens,$tpl);
}


That's it. My blog already has this code but beware that not all images will have lens info - Photoshop strips down all Nikon makernotes, so might other programs. Nikon Capture and ACDSee retain it.

me!
10-13-2006, 03:07 AM
Very cool. Thanks for sharinng. Just a question - Are you saying you can't use Photoshop or after you use Photoshop you have to resave in another application?

Thanks,
Y

zolotoiy
10-13-2006, 03:55 AM
Are you saying you can't use Photoshop or after you use Photoshop you have to resave in another application?

I'm saying that Photoshop doesn't retain Nikon makernotes. As soon as file is saved, that information is lost forever.

me!
10-13-2006, 04:29 AM
bummer....

y

Joe[y]
10-13-2006, 11:56 AM
i use photoshop with a nikon and don't seem to have that problem with exif being stripped when using the 'save as' function... (not the save for web...)

zolotoiy
10-13-2006, 02:04 PM
;37881']i use photoshop with a nikon and don't seem to have that problem with exif being stripped when using the 'save as' function... (not the save for web...)

Well, images on your blog don't have Nikon makernotes. I guess you just didn't pay attention to this.

me!
10-14-2006, 12:25 PM
Actually I was following for two reasons:
a) one friend is thinking of creating a photoblog using nikons. I would be the one helping her set it up. Or helping her to the best of my ablity.
b) I may be visiting a friends place this winter would has nikons, and I get to play with their cameras