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#">

5 comments:

Joel Funk said...

Thanks, this was very helpful.

Gabe said...

That hit the spot! Any ideas on what cfimage is choking on? This is a great work-around, though! Thanks!

Anonymous said...

Thanks for the hint (still occuring in CF10!), but this caused some performance problems.
Solved it like this: http://joeykrabacher.blogspot.ch/2013/02/coldfusion-invalid-image-format-solution.html

chris hough said...

Thank you for posting, this just saved my ass.

chris hough said...

Thank you for posting, this just saved my ass.

Related Posts Widget for Blogs by LinkWithin