Skip to main content
Participating Frequently
April 21, 2008
Question

CFIMAGE / ImageResize problems

  • April 21, 2008
  • 9 replies
  • 2785 views
Definitely there are some issues happening these days on the HMS servers since our images upload/resize functions stopped working since Friday.

I tried a lot of ways to fix this but seems to be a server related problem. We setup a test script trying to do this:

1. Upload a JPG file with a size greater than 640 x 480 on the server
2. Create a "thumbnail" of the images (150 x Y) and save it to "thumbs/" folder
3. Create a "big version" of the images (640 x Y) and save it to "images/" folder
4. Delete the original file

It crashes on the 3rd step, and saves only part of the resize JPG file.

http://www.viaromania.eu/upload/index.cfm

The error we are getting is this one:

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 : coldfusion.image.ImageWriter$ImageWritingException: An exception occured while trying to write the image.


Later edit:

- This is acting totally strange... for some JPG files it works fine, for some of them it crashes when trying to write the resized image on the server and for some of them it is crashing when trying to delete the original file from the disk. I just don't get it!

If you want to test it, download this image: http://www.viaromania.eu/upload/PICT0238.jpg

And try the script with it. It should crash on RESIZE.

Next, download this image: http://www.viaromania.eu/upload/_2422339695_237906822d_b.jpg

And try the script with it. It should crash on DELETE original file.

And download this image: http://www.flickr.com/photos/24769044@N08/2422339695/sizes/l/

And it will work fine...

What is going on? Does anyone else experienced the same problems?

NOTE: Images crashing were previously resized using ACDSee Pro software.
    This topic has been closed for replies.

    9 replies

    Participating Frequently
    May 9, 2008
    If you want to see the source code please check this:

    http://www.viaromania.eu/upload/upload.txt
    Inspiring
    May 9, 2008
    Adrian,

    I have not tried it, but it looks similar to your original code, which does work for me. At this point, I would suggest asking your provider about the hotfix. Mention that there was an update to the original (not a new hotfix). So it may have exact same version number. Ask if they applied the new update that was released on 05/07/2008 or just the original one from April 2008. You need the new one from 05/07/2008.

    Participating Frequently
    May 15, 2008
    Hey Guys,
    We tried the latest/greatest CFImage hotfix (updated) yesterday but we started finding the same errors again in the application.log:

    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 : coldfusion.image.ImageWriter$ImageWritingException: An exception occured while trying to write the image.

    We're still successfully using the java code workaround, but it is noticeably slower than the CFImage writing function, so we had to increase timeouts on the upload pages to deal with that.

    Is anyone else still experiencing this issue?

    Best,
    - Piper
    Participating Frequently
    May 9, 2008
    http://www.viaromania.eu/server.cfm

    PRODUCTVERSION 8,0,1,195765
    Inspiring
    May 9, 2008
    Adrian,

    That is what I have too. However, there were two releases of this hotfix: one in April and one this month. Unfortunately.. they both seem to have the same version information. So there was no change to my version number when I applied the updated (May 2008) version of the hotfix. Other than version number, I do not know how to tell the difference between the two.

    But again, since it is working for me I suspect the new updated hotfix was not applied. ie Perhaps they applied the one from April, but not the one released this month.
    Inspiring
    May 9, 2008
    Adrian,

    Yes, I can see the full exception now.

    I suspect the updated hotfix was not applied. You could try dumping the server scope and checking your version number. However, since this was an update to a previously released hotfix I do not know if the version numbers changed. What version do you see if you run this code?

    <cfdump var="#server#">
    Participating Frequently
    May 9, 2008
    Hi,

    Thanks for trying to help.
    So, we capture the errors and send it by email to webmaster that's why you didn't see it on the screen. The error you are getting is this:

    "Ensure that the destination directory exists and that Coldfusion has permission to write to the given path or file. cause : java.lang.NullPointerException
    MessageAn exception occured while trying to write the image. "

    I just turned OFF error capture so if you will try it now you will get the error.

    I am not 100% sure the patch was installed, all I have is an email from HostMySite telling me they applied the patch. Is there any way to test for myself if it was applied?
    Participating Frequently
    May 9, 2008
    Unfortunately there is no change. It still works only with the workaround found on Adobe support forum and not working using ColdFusion original "ImageWrite" function. If you want to try it yourself, I modified my original testing script so you can choose what function to use: the original CF - ImageWrite or the workaround - ImageWriteReplacement.

    Use this image: http://www.viaromania.eu/upload/sample/STA73827.JPG

    And this script: http://www.viaromania.eu/upload/

    Choose the first then the second checkbox.


    Adrian.
    Inspiring
    May 9, 2008
    Adrian,

    I tried the test page but cannot see the detailed error message. Just "Sorry, an error has occurred in displaying this page.".

    > Use this image: http://www.viaromania.eu/upload/sample/STA73827.JPG

    I have applied the updated patch. So I downloaded that image and tried it locally, using the code in your original post. It runs perfectly for me. Are you sure the patch was applied correctly? Verify that the server was restarted afterward. Otherwise, you would not see the changes.
    May 7, 2008
    Updated hot fix was published today. Visit http://www.adobe.com/go/kb402604 for list of all CF8/8.01 hot fixes. Again, the CFImage hot fix was updated today (5/7/08).
    Inspiring
    May 8, 2008
    Ken Smith wrote:
    > Updated hot fix was published today

    That is good news. Thanks for the update.
    Participating Frequently
    May 6, 2008
    CFSearching, the work around is working, thanks for the heads up!

    Kiran, I'm subscribed to this thread, as I'm sure a number of others are as well. Would you be so kind as to post here once more when the new hotfix is released?

    Thank you guys!
    - Piper
    Participating Frequently
    May 5, 2008
    We upgraded to 8.01 today (Windows 2003 server) and immediately started seeing problems with the CFIMAGE routines. The hotfix hasn't worked for us, though it seems to have made the frequency slightly less.

    Our application log shows a few of these every few minutes:

    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 : coldfusion.image.ImageWriter$ImageWritingException: An exception occured while trying to write the image.

    Is work on this hotfix ongoing? Can we expect to see an update sometime soon?

    Or.... my favorite and more typical situation, am I the only one still having this issue? :-)

    Many thanks,
    - Piper
    Participating Frequently
    May 6, 2008
    Soon we are releasing hotfix for the below mentioned image issues

    1) File locking issue -- Which will not allow you to overwrite the image
    2) Missing Huffman code table entry
    Inspiring
    April 22, 2008
    Inspiring
    April 26, 2008
    Follow-up:
    In one of the threads above KSmith mentions a patch is available for the file locking issue.

    Patch for CFImage and Image functions in ColdFusion 8.0.1 (kb403411)
    http://www.adobe.com/go/kb403411

    The patch does not resolve the second issue "Missing Huffman code table entry". At least not for me..
    Participating Frequently
    April 29, 2008

    > The patch does not resolve the second issue "Missing Huffman code table entry". At least not for me..

    can you please let me know the email address on which i can contact you..my email id ksakhare@adobe.com