This content has been marked as final.
Show 4 replies
-
1. Re: Help with CFIMAGE
-==cfSearching==- Dec 4, 2008 2:16 PM (in response to VaQueenB)> The value of this variable always comes up as a temporary file name with a .tmp extention.
Uploaded files are sent to a temporary directory and assigned a .tmp file extension. You must use cffile action="upload" to finish the upload (for lack of a better description). The file is already saved on the server, the call to cffile just moves it to a different directory and restores the correct file extension.
> The CFIMAGE fails every time because it is not recognizing the image file due to the .tmp .
> Any suggestions anyone????
1. Use cffile action=upload first
2. Use the ImageNew() function to read in the file -
2. Re: Help with CFIMAGE
VaQueenB Dec 5, 2008 8:03 AM (in response to -==cfSearching==-)Great, thanks. I was able to get the file uploaded fine, but am now having issues with the ImageNew(). I'm getting this error:
The ImageNew(uploadedFile,350,263) image format is not supported on this operating system.
My code is below. I want the image sized at 350x263.
Thanks for your help! -
3. Re: Help with CFIMAGE
-==cfSearching==- Dec 5, 2008 8:29 AM (in response to VaQueenB)VaQueenB wrote:
> I was able to get the file uploaded fine, but am now having issues with the ImageNew(). I'm getting this error:
Sorry, my response was unclear. I meant either use option 1 _or_ option 2. For whatever reason, ImageNew understands it is an image file, even though it has a .tmp file extension (unlike cfimage).
But since you are using option 1, just replace the "ImageNew(uploadedFile,350,263)" portion with the full path to your image file (ie c:\myimages\someImage.jpg). Your "result" variable will contain the file details, like the serverDirectory and file name. Use those values to construct the path to the file. Check the documentation to see all of the available file details:
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_f_10.html
Something like this should read in the image. It is not tested. So watch out for typos and verify it actually _does_ produce a valid file path ;-)
<cfset pathToImage = uploadedFile.serverDirectory &"\"& uploadedFile.serverFile>
<cfoutput>
debug pathToImage = #pathToImage#<br>
does the file exist? #FileExists(pathToImage)#
</cfoutput>
<cfimage action="read"
source="#pathToImage#"
name="readFile"
>
-
4. Re: Help with CFIMAGE
VaQueenB Dec 5, 2008 11:20 AM (in response to VaQueenB)Awesome! Worked great -- thanks for the help!!