• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFImage bug?

New Here ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

I'm having a problem with CFImage where it seems to be locking the image file it is using, making it unable to be deleted (even in windows file explorer).

Here is the scenario:
I upload an image file using cffile action=upload

I read the file in using cfimage

I resize the file (using imageResize()) and write it to disk using CFImage action="write" with a new file name.

I then try to delete the original uploaded file, and get an error:
ColdFusion could not delete the file d:\inetpub\wwwroot\site\cfml\images\listingimages\1998\000_0202.jpg for an unknown reason.

The reason appears to be that ColdFusion had locked the file. It only seems to happen with files over 300K in size.

I've tried everything I can think of to delete the file. Some have stayed locked and unable to delete until I restart the CF services.

I'm running CF8.0.1 on Win2003 server. Thanks for any help you can give.
TOPICS
Advanced techniques

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Apr 23, 2008 Apr 23, 2008

Votes

Translate

Translate
New Here ,
Apr 17, 2008 Apr 17, 2008

Copy link to clipboard

Copied

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.

TIA

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2008 Apr 20, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 20, 2008 Apr 20, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2008 Apr 21, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2008 Apr 21, 2008

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2008 Apr 21, 2008

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 22, 2008 Apr 22, 2008

Copy link to clipboard

Copied

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.

Thanks,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 23, 2008 Apr 23, 2008

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Apr 26, 2008 Apr 26, 2008

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 07, 2009 Mar 07, 2009

Copy link to clipboard

Copied

quote:

Originally posted by: ksmith
Try Patch for CFImage and Image functions in ColdFusion 8.0.1 (kb403411)


The patch worked! Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 03, 2010 Dec 03, 2010

Copy link to clipboard

Copied

LATEST

I had the same problem and the patch worked also for me. Thank you!


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation