Managed Hosting



Project Home Blog Forums Known Issues External Project Link Contact Project

ImageCFC Issue: Problems with PNGs?

Name: Problems with PNGs?
ID: 5
Project: ImageCFC
Type: Bug
Area: Code
Severity: Normal
Status: Closed
Related URL:
Creator: Adam Tuttle
Created: 07/05/07 10:42 AM
Updated: 09/02/09 7:10 PM
Description: I have a PNG that I'm trying to read the width/height of. It was created with MSPaint, if that matters. When I run the following code:

<cfset imageCFC = createObject("component", "com.ImageCFC.image")>
<cfset imgInfo = imageCFC.getImageInfo("", expandPath(attributes.monogram_url_source))>

I get the following error:

Variable IMG is undefined.

The error occurred in C:\Inetpub\wwwroot\com\ImageCFC\image.cfc: line 671
Called from C:\Inetpub\wwwroot\com\ImageCFC\image.cfc: line 620
Called from C:\Inetpub\wwwroot\com\ImageCFC\image.cfc: line 108
Called from C:\Inetpub\wwwroot\CustomTags\ct_conceptDisplay.cfm: line 79
Called from C:\Inetpub\wwwroot\Flash\DesignCenter\examples\text.cfm: line 45

669 :             <cfreturn retVal>
670 :          <cfelse>
671 :             <cfset retVal.img = img>
672 :             <cfset retVal.inFile = inFile>
673 :             <cfreturn retVal>

However, if I save that PNG as a JPEG, it works fine.
History: Created by adam.tuttle (Adam Tuttle) : 07/05/07 10:42 AM

Updated by rickroot (Rick Root) : 09/02/09 7:10 PM
To avoid generating an error, that <cfset img = imageIO.read(file)> line is now rapped in try/catch.

I'm afraid I can't tell you why it couldn't read that particular image, but it doesn't surprise me that MSPaint doesn't do PNGs very well. :)

To add a comment to this bug, please login using the link above.