Skip to main content
Inspiring
April 17, 2009
Question

cfimage error

  • April 17, 2009
  • 1 reply
  • 1519 views

I am writing code to resize a relevant image on my system. But though I have followed the coding rules correctly, I keep getting an error that:

The images/consumer/ image format is not supported on this operating system.

Use GetReadableImageFormats() and GetWriteableImageFormats() to see which image formats are supported.

What is wrong with my code? TIA

Here is my code:

<<cfset imgTypes = GetReadableImageFormats()>

 

  <cfoutput query="ConsumerSimpleSearch">

  <tr>

 

    <td width="10%"><!--- creating a resized version of uploaded image of product. --->

<cfimage source="images/consumer/#Cnsmr_ProductIMAGE#" action="resize" width="100" height="60" name="resizedImg" format= "#imgTypes#">

<cfimage source="#resizedImg#" action="writeToBrowser"><!---img src="images/consumer/#Cnsmr_ProductIMAGE#"---></font></td>

    <td width="90%"><font size="+2">#Cnsmr_ProductDESCRIPTION# </font>  <font size="+2"><a href="showProductDetail.cfm?Cnsmr_ProductID=#URLEncodedFormat(TRIM(Cnsmr_ProductID))#">#Cnsmr_ProductMODELNo# </font> </a>

                <font size="+2">#Cnsmr_ProductMODELYEAR# </font>   <font size="+2">#Cnsmr_ProductPRICE#</font>  <font size="+2">#User_id#</font>

</td>

  </tr> <br> </br>

</table>

</cfoutput>

    This topic has been closed for replies.

    1 reply

    Inspiring
    April 18, 2009

    Abdlah wrote:

    But though I have followed the coding rules correctly, I keep getting an error that:

    The images/consumer/ image format is not supported on this operating system.

    Use GetReadableImageFormats() and GetWriteableImageFormats() to see which image formats are supported.

    No.  "images/consumer/" is not a valid path to an image file or url. 

    Also, an image can only have one format.  ie It is either a png or gif, not both.  So "format" should be a single value.

    AbdlahAuthor
    Inspiring
    April 18, 2009

    So what do I do to get the right format? and why is the filename that is supposed to be resolved by the #Cnsmr_ProductIMAGE# of my path "/images/consumer/#Cnsmr_ProductIMAGE#" not being shown?

    My project folder in the webroot is named store and the images folder which contains the consumer folder which in turn contains the images I am trying to access. So would I construct a valid path under this scenario?

    Also thought the function the results returned by GetReadableImageFormats() ( and I get: BMP,GIF,JFIF,JPEG,JPEG 2000,JPEG-LOSSLESS,JPEG-LS,JPEG2000,JPG,PNG,PNM,RAW,TIF,TIFF,WBMP) are all acceptable.

    TIA

    Inspiring
    April 19, 2009

    Abdlah wrote:

    why is the filename that is supposed to be resolved by the #Cnsmr_ProductIMAGE# of my path "/images/consumer/#Cnsmr_ProductIMAGE#" not being shown?

    Look at the results of your query.  What is the value of #Cnsmr_ProductIMAGE# and does images/consumer/#Cnsmr_ProductIMAGE# produce a valid image path?

    Also thought the function the results returned by GetReadableImageFormats() ( and I get: BMP,GIF,JFIF,JPEG,JPEG 2000,JPEG-LOSSLESS,JPEG-LS,JPEG2000,JPG,PNG,PNM,RAW,TIF,TIFF,WBMP) are all acceptable.

    The GetReadableImageFormats() is just a troubleshooting tool.  It tells you _all_ of the image types the server can create.  But that is not what the "format" property is asking for.  An image can only have one format at a time. It can be a PNG, GIF, JPG etcetera.  It cannot be _all_ of those at the same time.  The "format" value is a single value.  That value is the type of image you would like to create:  a png, gif, ... OR ... jpg.