Copy link to clipboard
Copied
Hi, guys...
I've found imageGetExifMetadata for extraction.
Now, I'm trying to figure out how to edit an image's meta data.
Can CF do that, itself?
If not, anyone have a solution?
Thanks for any assistance!
Rick
Copy link to clipboard
Copied
I don't think CF will let you do that directly.* But there is an Apache Commons project that will let you do that, in theory:
https://commons.apache.org/proper/commons-imaging/
There are also plenty of command-line tools that will manipulate EXIF data. I use one called, uh, exiftool.exe. You can automate this with CFEXECUTE, probably.
* note: CF may use the previous version of Apache Commons, Sanselan, to support imageGetExifMetadata already. I saw a forum post that mentioned it briefly, I think. I'd probably go with exiftool.exe actually, now that I think about it.
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
Like Dave, I don't think ColdFusion has any functionality to directly edit image metadata. I would go for Dave's second recommendation, ExifTool. You could, for example, run the Windows Executable ExifTool using ColdFusion's cfexecute.
ExifTool is Open Source and is extensively documented. See, in particular, the ExifTool Writing Examples.
Now, some proof of the pudding.
I gave it a go as follows:
<cfscript>
img=imagenew("C:\ColdFusion2021\cfusion\images\dir\testImage.jpg");
// Store the exif metadata as an HTML in the logs directory
writedump(var=imagegetexifmetadata(img), format="html", output="#server.coldfusion.rootdir#\logs\testImageExif.html");
writeoutput("done");
</cfscript>
<cfexecute name="C:\bin\Exif tool for images\exiftool-12.41\exiftool.exe" arguments=" -AllDates+=1:30 C:\ColdFusion2021\cfusion\images\dir\testImage.jpg" />
done
Copy link to clipboard
Copied
Thanks for he info!
Copy link to clipboard
Copied
Thanks!
Copy link to clipboard
Copied
I've written a IPTC CFC to do this for professional photographers that we've developed web applications for. The script uses ExifTool. I've searched other methods, but nothing matches ExifTool in terms of metatags support and performance. (We did this so results in Google Photo search would display their copyright data. It's better to have the data embedded within each image rather than contained in a separate HTML-based XML tag on a webpage.)
Please note that when you update JPG metadata, you'll need to update multiple fields because different programs look in different areas. For instance, when updating "Credit", we update the following metadata using ExifTool:
Copy link to clipboard
Copied
That is a great answer.
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
Thanks for the info!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now