2011-05-28 63 views
0

當用戶上傳大圖像時,使用cfimage縮小圖像的大小時出現此錯誤。它似乎只投射更大的圖像。小的通過確定。我還沒有看到這個問題,看到谷歌/ SO ...解碼器無法解碼輸入

我正在運行CF8。這裏是代碼,標誌着它失敗行:

<cffile action="move" source="#imgVars.fileData#" destination="#imgVars.folder#\#imgVars.newFileUUID#.#listlast(imgVars.fileName, '.')#" /> 
    <cfset newFile = imgVars.folder & '/' & imgVars.newFileUUID & '.' & listlast(imgVars.filename, '.')> 
    <cfif fileexists(newFile)> 
    <cfimage action="read" source="#newFile#" name="imageToUpload"><!---FAILURE---> 
    <cfif ImageGetHeight(imageToUpload) gt 800 or ImageGetWidth(imageToUpload) gt 600> 
    <cfset ImageScaleToFit(imageToUpload, 800, 600, "bilinear")> 
    <cfimage source="#imageToUpload#" action="write" destination="#newFile#" overwrite="yes"> 
    </cfif> 
    <cfif ImageGetWidth(imageToUpload) gt 600> 
    <cfset ImageScaleToFit(imageToUpload, 600, 600, "bilinear")> 
    <cfimage source="#imageToUpload#" action="write" destination="#newFile#" overwrite="yes"> 
    </cfif> 
</cfif> 

回答

0

嘗試使用isImageFile()代替fileExists()

相關問題