Dear ColdFusion baddies,
I would like to know if there is a way to add metadata info when I’m upload a picture through the CF!
e.g. you can do it through PhotoShop http://www.artsnova.com/x/Chicago-Artists-Coalition-email-metadata.jpg “Photoshop MetaData”
I suppose i can convert the picture to Base64, inject my info there and then write back to file:
<cfimage action="write" source="#ImageReadBase64(form.myBase64Image)#" destination="#filePath##fileName#">
I have noticed that there is in the JPG file the following Tags:
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27 ">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:aux="http://ns.adobe.com/exif/1.0/aux/" xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xmpRights="http://ns.adobe.com/xap/1.0/rights/" xmp:Rating="0" xmp:CreatorTool="Adobe Photoshop CS6 (Windows)" xmp:ModifyDate="2014-06-20T11:59:38+02:00" xmp:CreateDate="2014-06-03T07:52:21" xmp:MetadataDate="2014-06-20T11:59:38+02:00" aux:SerialNumber="193020002656" aux:LensInfo="28/1 300/1 0/0 0/0" aux:Lens="28-300mm" aux:LensID="6" aux:LensSerialNumber="0000000000" aux:ImageNumber="0" aux:FlashCompensation="0/1" aux:Firmware="1.2.3" photoshop:DateCreated="2014-06-03T07:52:21.001" photoshop:LegacyIPTCDigest="3AB878C7DE3E2C7D46FA1D558A375445" photoshop:ColorMode="3" photoshop:ICCProfile="sRGB v1.31 (Canon)" xmpMM:DocumentID="F5AE03309FA9337F43EA71C52F6B6C0D" xmpMM:InstanceID="xmp.iid:4E811E5E61F8E31183E6DB5EA6C6987D" xmpMM:OriginalDocumentID="F5AE03309FA9337F43EA71C52F6B6C0D" dc:format="image/jpeg" xmpRights:WebStatement="http://www.mywebsite.com">
<xmpMM:History>
<rdf:Seq>
<rdf:li stEvt:action="saved" stEvt:instanceID="xmp.iid:274f1a37-ad8a-40d8-b5d2-03cea0cf8c52" stEvt:when="2014-06-04T16:44:12+01:00" stEvt:softwareAgent="Adobe Photoshop CC (Macintosh)" stEvt:changed="/"/>
<rdf:li stEvt:action="saved" stEvt:instanceID="xmp.iid:4E811E5E61F8E31183E6DB5EA6C6987D" stEvt:when="2014-06-20T11:59:38+02:00" stEvt:softwareAgent="Adobe Photoshop CS6 (Windows)" stEvt:changed="/"/>
</rdf:Seq>
</xmpMM:History>
<dc:rights>
<rdf:Alt>
<rdf:li xml:lang="x-default">This Picture is a Property of My Company</rdf:li>
</rdf:Alt>
</dc:rights>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
But if i add or change those info manualy, then the JPG is Corrupted!
Any ideas or approach will be much appreciated!
Regards
2
Answers
There is a function
ImageGetMetadata()
which gets the meta data but looking at the docs I can not see a setter.This answer talks about some custom tags that may be able to help you. https://stackoverflow.com/a/2863843/1218040
There is no trivial way to edit image metadata with ColdFusion. You should use some 3rd party tool (using cfexecute tag) or java library to perform this task. Look at these answers: