Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'd like to populate custom media type properties with already extant EXIF/IPTC data, but that is utter witchcraft and I have no idea where to even start!
Any suggestions greatly appreciated!
Maybe this could help you out?
Thanks, I'll have a look - it absolutely reads the data I need, just gotta figure out how to access it!
Thought I'd come back and post the solution I used in the end for the benefit of anyone else searching.
I used Drew Noakes' Metadata Extractor library:
Here's some example code to extract IPTC data. In a nutshell, you pass a physical path for your file to ImageMetadataReader.ReadMetadata to get a handle on the set of directories that hold each type of metadata, then use MetadataExtractor.Formats to pull the specific directory you need (e.g. EXIF, IPTC, DICOM).
Then instance MetadataExtractor.Formats.xxxx.xxxxDescriptor , where the xxxx refers to your chosen metadata type, and you can then extract the specific values for metadata tags.
The exception is Adobe XMP data, which is stored a bit differently, but our man Drew Noakes has you covered:
var image = Model.Value<IPublishedContent>("Image");
<!-- get physical path of image -->
var physicalPath = Server.MapPath(image.Url);
<!-- get IPTC metadata -->
var directories = ImageMetadataReader.ReadMetadata(physicalPath);
var IptcDir = directories.OfType<MetadataExtractor.Formats.Iptc.IptcDirectory>().FirstOrDefault();
if (IptcDir != null)
var descriptor = new MetadataExtractor.Formats.Iptc.IptcDescriptor(IptcDir);
// get IPTC values
String IptcCopyright= descriptor.GetCopyrightNoticeDescription();
String IptcSource= descriptor.GetSourceDescription();
You son of a gun! Thanks to your pasted code I was able to do this for my site as well! :)
In another topic of mine I was overthinking this and trying to use the Metadata extractor from Drew Noakes also but trying to use a surface controller to pass the data along...
But clearly it was possible to do it from Umbraco directly without the need of a surface controller.
Many thanks for pointing me in the right direction!
Ha! Glad I could help!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted