Skip to main content
Participant
January 15, 2009
Question

New CFImage problem

  • January 15, 2009
  • 2 replies
  • 892 views
I am using CFImage and seeing some strange behavior. The image uploads just fine, but on resize I get the following error message:

"ColdFusion was unable to create an image from the specified source file.Ensure that the file is a vaild image file. The specific sequence of files included or processed is: D:\InetPub\xxxxx\admin\pod.cfm, line: 38

I'm using exclusively JPGs in this app. The error variously occurs on one of the "resize" directives below. Full routine code is below:

<cffile action="UPLOAD" filefield="form.pod_filename" destination="#danet_path#images\pod\" nameconflict="MAKEUNIQUE" attributes="Normal">

<cfset processimage="#File.ServerFile#">

<!-- create fullsize -->

<cfimage action="RESIZE" source="#danet_path#images\pod\#processimage#" destination="#danet_path#images\pod\#File.ServerFileName#_full.jpg" width="530" height="" overwrite="Yes">

<!-- create front page -->

<cfimage action="RESIZE" source="#danet_path#images\pod\#processimage#" destination="#danet_path#images\pod\#File.ServerFileName#_thm.jpg" width="390" height="" overwrite="Yes">

<!-- create mini -->

<cfimage action="RESIZE" source="#danet_path#images\pod\#File.ServerFileName#_thm.jpg" destination="#danet_path#images\pod\#File.ServerFileName#_mini.jpg" width="250" height="" overwrite="Yes">

<cfimage source="#danet_path#images\pod\#File.ServerFileName#_mini.jpg" name="pod_img">

<cfset ImageCrop(pod_img,55,0,140,140)>

<cfimage action="WRITE" source="#pod_img#" destination="#danet_path#images\pod\#File.ServerFileName#_mini.jpg" overwrite="yes">
    This topic has been closed for replies.

    2 replies

    Inspiring
    January 15, 2009
    > 2. Looks like the app likes lowercase extensions only...
    > ie. ".jpg" works, but ".JPG" does not.

    It works fine for me on windows. Are you using a different o/s?

    > IIRC, CFImage seems to require this.

    Hmm... I think my memory may be failing me on this one. I just tried it and it seems to work, so I may be mistaking this with some other problem I had with cfimage and file extensions.
    Inspiring
    January 15, 2009
    I suspect the answers to questions 1 and 2 are yes, but I would start by checking the following:

    1. Was the file actually uploaded successfully? Check the CFFILE.fileWasSaved variable.
    2. Does the source file value passed to cfimage have an image file extension (ie like .jpg, .jpeg, etc..)? IIRC, CFImage seems to require this.
    3. What updaters have you installed? There was a patch for image functions:
    http://kb.adobe.com/selfservice/viewContent.do?externalId=kb403411&sliceId=1

    BTW, "FILE" is deprecated. Use either "CFFILE" or the "result" attribute of cffile.
    http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_f_10.html#3540091
    oliroAuthor
    Participant
    January 15, 2009
    1. Yes, the file does upload correctly. This was the first thing I checked, and I can see the file uploaded when I view the remote directory via FTP.

    2. Looks like the app likes lowercase extensions only...ie. ".jpg" works, but ".JPG" does not.

    3. I've changed the code to use the "result=" attribute...thanks for the tip!
    January 15, 2009
    I'm not sure, and I know this sounds odd, but I'm not sure that you should be prefixing your form variable with "form.variable" in the CFFILE tag.

    e.g.

    <cffile action="UPLOAD" filefield="form.pod_filename" destination="#danet_path#images\pod\" nameconflict="MAKEUNIQUE" attributes="Normal">

    Should be...

    <cffile action="UPLOAD" filefield="pod_filename" destination="#danet_path#images\pod\" nameconflict="MAKEUNIQUE" attributes="Normal">

    At least I remember something like this. Seems weird but that might solve it? I dunno! Could someone verify?

    Good luck.
    Mikey.