Tuesday, December 07, 2010

CFIMAGE: Invalid image format - solution

Sometimes when you try to read an image with CFIMAGE using the filename,
it will fall over with "Invalid image format" using Coldfusion 8.0.1

The solution is easy enough, just read the image into a variable
and Coldfusion inspects the binary file contents rather than just being annoying

<cffile action = "readbinary" file="d:\inetpub\wwwroot\test.jpeg" variable="tmpBin">
<cfimage action="READ" name="tmpImage" source="#tmpBin#">