This content has been marked as final. Show 11 replies
We have noticed the same issue in the same type environment (CF8.0.1 on Win2003 server).
For us, it seems to lock the source image no matter the size of the jpg. After the file is uploaded, we try to resize it and then write the image back out to the same filename (with overwrite="true"). This causes an error. Resizing to a different filename works.
For us it seems any JPG image that is used as the source in a cfimage resize will be left locked.
We have tried using cfimage with source and destination set (as the same JPG file name with OS path) and Overwrite set to true (RESULT: Errors out with "Ensure that the destination directory exists and that Coldfusion has permission to write to the given path or file. cause : java.io.FileNotFoundException").
We have tried resizing the image into memory then tried to cffile delete the source file... wanting to write the image back to the drive from memory (RESULT: errors out saying the file cannot be deleted)
What we have done for now is to rename the file to a XXXXX_TEMP.JPG temp file and resize it to the needed destination. Works perfectly but leaves behind _TEMP.JPG files that cannot be deleted due to a file lock.
As Administrator on the server we cannot delete or rename the source file for about 30-45 minutes after the resize is completed (or we restart the ColdFusion service)
Any work around or fixes to this issue would be greatly appreciated.
We have this same issue. It seems to happen with every image now.
I believe it has something to do with a recent CF update that one of our customer's hosting providers has applied, however they do not know which it is.
I was thinking of a fix involving uploading the new file to the CFTemporary directory. However I was wondering if and how often the CFTemp directory is purged automatically.
We came up with a workaround since the issue seems to be a bug. We are now uploading to a directory, reading the file and resizing, then saving it to a different directory (leaving us with 2 files). This way the original file can stay locked because we never write to it. To get rid of the original files in that directory, we run the attached code nightly as a scheduled task to purge any images from that upload directory that haven't been accessed in the last 30 minutes. The files seem to unlock after a period of time, so deleting them hasn't been a problem. So far this workaround has done the job.
Please post back if you found a better solution or a fix.
That's pretty much what we were going to do, except with using the CF Temp directory to try and handle the auto delete. I don't see any other way to work around this.
This is definitely a bug. We first noticed it after the CF 8.0.1 update but we didn't really do too much/any resizing before the last few weeks.
Anyone know how to submit a bug to the ColdFusion dev team? I see how for Flex but not for CF.
I submitted the bug report. Now I just realized that I should have mentioned this thread in that report.
If anyone else is going to submit one, include a link to this thread in the report as well.
Ken Smith wrote:
Try Patch for CFImage and Image functions in ColdFusion 8.0.1 (kb403411)
Thanks. I installed the patch and it seems to have fixed the file locking issues.
Another image issue raised by hans blix is a Missing Huffman code table entry error that occurs with some images. Do you know if this exception is caused by a problem with the image files themselves or an issue with updater 1?
I had the same problem and the patch worked also for me. Thank you!