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

cfimage resize problem

Contributor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

I have a page that controls our staff directory, including uploading photos of staff members.

I have a form with a browse button, and it successfully uploads the picture.  Where it fails is resizing both the photo and the thumbnail.

Here's the code I'm using for the resize:

<cfset source = "D:\Inetpub\staffnet_test\hep\bios\#lcase(filename)#">

<cfset destination = "D:\Inetpub\staffnet_test\hep\bios\thumbs\#lcase(filename)#">

<!--- resize main image --->

<cfimage

    action="resize"

    height="180"

    width="240"

    source="#source#"

    destination="#source#"

    overwrite="yes">

<!--- resize thumb --->

<cfimage

    action="resize"

    height="90"

    width="120"

    source="#destination#"

    destination="#destination#"

    overwrite="yes">

The "source" location is where the fullsize image is first uploaded.  The first section of code resizes that pic.  The second creates a thumbnail.  It fails with the following error:

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: D:\Inetpub\staffnet_test\hep\bios\kevin.adderly.jpg (The system cannot find the file specified)

The error occurred in D:\Inetpub\staffnet_test\hep\admin\hepadmin.cfm: line 100

Line 100 is the first overwrite="yes" line.  Any ideas?  I'm running CF 8.01

Views

1.0K

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
LEGEND ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

Are you sure the file is successfully reaching the upload folder?  Are you sure that the file is being copied to the source folder, if it's different from the upload folder?  Do all folders give the user account for CF permissions for write?

^_^

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
Contributor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

Yep, the file (huge file) successfully uploads to both locations.  They're both 2.4MB instead of the 71KB that the older pics are (or 41KB for thumbs).  The files are there, but as to whether there are file permissions issues, I have no idea.  CF here runs under the system account, so it seems like it should have rights to do just about anything.

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
LEGEND ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

File not found is pretty specific.  There has to be something preventing CF from "seeing" the files.

^_^

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
Contributor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

I tried this instead:

<cfset main = ImageNew("D:\Inetpub\staffnet_test\hep\bios\#lcase(filename)#")>

<cfset thumb = ImageNew("D:\Inetpub\staffnet_test\hep\bios\thumbs\#lcase(filename)#")>

<cfset ImageResize(main,"180","")>

<cfset ImageResize(thumb,"90","")>

No error, but no resizing either.

I'm not sure why it wouldn't find the file.  It's a Windows machine, so not case sensitive.  Let me try to return the path variable names and see what I get.  Odd though, because the upload function uses the same variables, and the files upload fine.

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
Contributor ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

Yep, it's got to be a permissions thing, because when I delete the file, I get a completely different error message.

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
LEGEND ,
May 31, 2013 May 31, 2013

Copy link to clipboard

Copied

LATEST

Check to make sure that the CF account also has permissions in IIS (or whatever web server you're utilizing) for those folders.

^_^

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