* This applies to CFWebstore versions 6.x on a Coldfusion 8 or 9 server. Only effects the
When you try to upload a JPEG image that's formatted as CMYK and you try to create a thumbnail, you get an error. Turns out that
The easiest solution to is to convert the image to RGB after it has been uploaded. Coldfusion can't do it but the underlying JAVA can. I found the original code on the Adobe discussion board - http://forums.adobe.com/thread/573440. I've altered it a bit to use the variables on admin/imagemanager/act_image_manager.cfm.
/* init JAI, read file */ JAI = createObject("Java","javax.media.jai.JAI"); img = JAI.create("fileload","#pImage#"); /* init colorspace to convert to RGB */ model = img.getColorModel(); space = model.getColorSpace(); rCS = createObject("java","java.awt.color.ColorSpace").CS_sRGB; rgb = createObject("java","java.awt.color.ColorSpace").getInstance(rCS); convert = createObject("java","java.awt.image.ColorConvertOp").init(rgb,javaCast("null","")); //convert JAI to normal Java buffered img bImg = img.getAsBufferedImage(); rgbImg = convert.filter(bImg,javaCast("null","")); /* back to CF */ newImg = ImageNew(rgbImg); // strangely, JAI seems to have created a negative image imageNegative(newImg);
You need to add the code just after ~line 173, where you upload the image.
First, the code sees if Coldfusion recognizes the file as an image, if not, then it's a CMYK. The next section uses JAVA to convert the image RGB and then overwrites the original file. Processing continues regularly after that.
Thanks for this - helped solve it for me. I looked at the adobe forums post as well but having the normal cf text around the cfscript always makes it easier to understand for me cheers Richard