ColdFusion 8 CHF4 [doesn't] break CFIMAGE [UPDATE]
UPDATE 2: There is actually an issue with ColdFusion Cumulative Hotfix 4, though it's not the Hotfix itself, it's the installation instructions explicitly telling you to skip installing another hotfix if you're not on JVM 1.5. Don't skip installing hf801-71557, even when you're on JVM 1.6 - that has fixed it with our installation.
There seems to be an issue with <cfimage action="resize" overwrite="yes" ... /> after the update to ColdFusion 8 cumulative hotfix 4 when source and destination file path are identical. From what I have seen so far, it seems like CFIMAGE opens a filehandle and "forgets" to close it after it is done. We haven't found a workaround yet. It'd be nice if somebody could confirm the issue. Does it exist with CF9, too?
Here's how to reproduce:
<cfset fSource = '/var/www/somepathto/test.jpg'> <cfimage action="resize" source="#fSource#" destination="#fSource#" overwrite="yes" height="100" width="200" />
This will throw an exception:
An exception occured while trying to write the image. Ensure that the destination directory exists and that Coldfusion has permission to write to the given path or file. cause : java.io.FileNotFoundException: /var/www/somepathto/test.jpg (No such file or directory)
After that, the original file /var/www/somepathto/test.jpg is gone.
We tried to workaround the issue by creating a temporary file and then moving this to the original destination. This doesn't work reliably either:
<cfset fSource = '/var/www/somepathto/test.jpg'> <cfset fTemp = '/var/www/somepathto/' & createUUID() & '.' & ListLast(fSource,'.')> <cfimage action="resize" source="#fSource#" destination="#fTemp#" overwrite="yes" height="100" width="200" /> <cffile action="move" source="#fTemp#" destination="#fSource#">
This does sometimes work, sometimes it leaves a stale NFS handle like .nfs0000000000998aa000000 in the directory. Same thing (stale NFS file handles) happens when we copy the file and delete the temporary file with CFFILE.
We didn't use to see this kind of behaviour before the update, so I guess that there must be some kind of correlation. The stale filehandles disappear as soon as the ColdFusion server is being stopped or restarted.
For now we'll probably replace CFIMAGE with calls to ImageMagick - but this is tedious and we'd very much like to continue using CFIMAGE for such tasks.
Any ideas?
UPDATE:We noticed that the issue only affects specific JPG files. ImageMagick doesn't run into issues with any of those files, but CFIMAGE does. We haven't yet found out the exact nature of the problem, but it seems like Adobe Photoshop may be the culprit. Here's one of the files that cause CFIMAGE to throw the exception and delete the file:

Here's another image causing problems.
The first image has Exif data indicating it has been created with Adobe Photoshop CS3, the second bears a similar mark, only this time it's Adobe Photoshop 7.0. A colleague of the graphics artist persuasion has opened and then saved the images in Photoshop as "Web JPG" - these converted files do not show any problems. There is however another option to save images as JPG, or so I am told, which actually produces the broken images. Broken for CFIMAGE, that is, as ImageMagick doesn't complain. So I still see this as a bug in CFIMAGE, and what's more disturbing, it seems to be some incompatibility with Adobe's very own Photoshop, if I am not too much mistaken.
I'd still be very happy if somebody could shed a little more light on the issue, though. Are there any workarounds that allow us to deal with the issue, other than switching from CFIMAGE back to ImageMagick?
UPDATE 2: I think I have now identified the cause of the issue - it seems to be an error in the installation instructions of Cumulative Hotfix 4. See "Installing the hot fixes", Step 2:
2. (Applies only if you are using JDK 1.5, else ignore the step) Do the following:...
What you really should ignore is the bit inside the brackets, or so it seems. After installing hf801-71557, the images that used to cause CFIMAGE to crash are now being processed without any problems.
