Picture Library and Exif data
As Jeremy Sublett wrote in his post Getting Date Information From Photos in SharePoint it would be great if SharePoint would respect the Exif data from a picture uploaded to a picture library. So I took his solution as starting point to wrap this functionality into a feature, which can be configured for each picture library.
So what does it do?
The “Date Picture Taken” value will be used from the Exif data of a picture after it has been uploaded.
How do I get this?
1. Install the solution
2. Activate the feature on the Website where you want to use it
3. Click on the "Picture Library Exif" link within your Picture Library Properties.
Next you can activate the functionality.
Changes from the original solution
1: properties.ListItem[SPBuiltInFieldId.ImageCreateDate] = imageDate;
<pre style="padding-right:0px;padding-left:0px;font-size:8pt;padding-bottom:0px;margin:0em;overflow:visible;width:100%;color:black;border-top-style:none;line-height:12pt;padding-top:0px;font-family:consolas, 'Courier New', courier, monospace;border-right-style:none;border-left-style:none;background-color:#f4f4f4;border-bottom-style:none"><span style="color:#606060"> 2:</span> item.SystemUpdate();</pre>
I am using the SPBuiltInFieldId enum to address the field, because now the language of your picture library doesn’t matter. And this enum is cool 🙂
Also a SystemUpdate will not generate another version, if you have enabled versioning.
As Jeremy pointed out, sometimes the EditForm will not show the “Date Picture Taken” value after uploading a picture. If you press F5 or refresh the page in your browser, it will show up.
Why that?
The event handler which modifies the data runs after the picture has been uploaded. It reads the value from the picture and puts the value in the SharePoint field. This takes some time. If the browser is faster loading the EditForm than the event handler changing the value, this happens.
As you can see on the last screenshot, I have implemented my UpdateVersion function in the solution, so you can always see if you got the latest version installed.