0

/t5/coldfusion-discussions/yet-another-cfimage-bug/td-p/959781
Apr 28, 2008
Apr 28, 2008
Copy link to clipboard
Copied
Sorry for the sarcastic title, but this is the third major
CFImage bug I've found in 2 weeks.... I love ColdFusion, but this
is getting ridiculous.
The error occurs when writing a JPG file to disk using cfImage action="write". In our scenario, the file is uploaded by a user, then read in using cfimage action="read". The error below occurs when the file is written.
The following image will cause the error:
http://img246.imageshack.us/img246/7003/024nt5.jpg
Error:
javax.imageio.IIOException: Quantization table 0x02 was not defined at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:996) at coldfusion.image.ImageWriter.writeJPeg(ImageWriter.java:60) at coldfusion.image.ImageWriter.writeImage(ImageWriter.java:119) at coldfusion.image.Image.write(Image.java:578) at coldfusion.tagext.io.ImageTag.performWrite(ImageTag.java:593)
If someone can please verify it that would be great.
One note, I have not installed the patch recommended for one of the other issues, located here:
http://www.adobe.com/go/kb403411
The patch notes didn't make any mention of this problem, and I haven't had a chance to test it yet.
The error occurs when writing a JPG file to disk using cfImage action="write". In our scenario, the file is uploaded by a user, then read in using cfimage action="read". The error below occurs when the file is written.
The following image will cause the error:
http://img246.imageshack.us/img246/7003/024nt5.jpg
Error:
javax.imageio.IIOException: Quantization table 0x02 was not defined at com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:996) at coldfusion.image.ImageWriter.writeJPeg(ImageWriter.java:60) at coldfusion.image.ImageWriter.writeImage(ImageWriter.java:119) at coldfusion.image.Image.write(Image.java:578) at coldfusion.tagext.io.ImageTag.performWrite(ImageTag.java:593)
If someone can please verify it that would be great.
One note, I have not installed the patch recommended for one of the other issues, located here:
http://www.adobe.com/go/kb403411
The patch notes didn't make any mention of this problem, and I haven't had a chance to test it yet.
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer

May 07, 2008
May 07, 2008
Updated hot fix was published today. Visit
http://www.adobe.com/go/kb402604
for list of all CF8/8.01 hot fixes. Again, the CFImage hot fix was
updated today (5/7/08).
Valorous Hero
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959782#M87680
Apr 28, 2008
Apr 28, 2008
Copy link to clipboard
Copied
I tested the image with the patch applied. The result is the
same: javax.imageio.IIOException: Quantization table 0x02 was not
defined ... However, ImageIO.write is able to save this image to
disk
<cfscript>
imageVariable = ImageNew( ExpandPath('024nt5.jpg') );
bi = ImageGetBufferedImage(imageVariable);
outFile = createObject("java", "java.io.File").init( ExpandPath('024nt5_savedWithImageIO.jpg') );
ImageIO = createObject("java", "javax.imageio.ImageIO");
ImageIO.write( bi, "jpeg", outFile );
</cfscript>
I assume this does not happen with every image, just certain image files? Again, while I suspect it may be a bug, without knowing more about the internals of CF's image handling, there is still a small chance that the cause may be the image file itself. I know that does not help with your current issue, but using the ImageIO.write work-around will let you to write the images to disk. At least until you have a definitive answer, one way or the other.
<cfscript>
imageVariable = ImageNew( ExpandPath('024nt5.jpg') );
bi = ImageGetBufferedImage(imageVariable);
outFile = createObject("java", "java.io.File").init( ExpandPath('024nt5_savedWithImageIO.jpg') );
ImageIO = createObject("java", "javax.imageio.ImageIO");
ImageIO.write( bi, "jpeg", outFile );
</cfscript>
I assume this does not happen with every image, just certain image files? Again, while I suspect it may be a bug, without knowing more about the internals of CF's image handling, there is still a small chance that the cause may be the image file itself. I know that does not help with your current issue, but using the ImageIO.write work-around will let you to write the images to disk. At least until you have a definitive answer, one way or the other.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959784#M87682
Apr 29, 2008
Apr 29, 2008
Copy link to clipboard
Copied
I also stumbled upon the exact same problem after running the
cf 8.01 updater. I've added a function to my code to allow the
image to be written using ImageIO or the JPEG encoder if imageWrite
fails. I've attached it if anyone else wants to use it.
Mark
Mark
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959785#M87683
Apr 29, 2008
Apr 29, 2008
Copy link to clipboard
Copied
Thanks for the workarounds and confirmations. I've reported
the bug to Adobe. Out of curiosity, has anyone tried performance
testing the ImageIO method?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959786#M87684
Apr 29, 2008
Apr 29, 2008
Copy link to clipboard
Copied
markthickpaddy,
Thanks for posting it. Though it is worth mentioning the general recommendation is not to use com.sun.* classes directly because they are part of a "Sun proprietary API and may be removed in a future release".
Here is a quick adaptation of an example on sun.com http://java.sun.com/developer/JDCTechTips/2004/tt0217.html. Though it probably needs to be modified to account for the available quality settings.
Thanks for posting it. Though it is worth mentioning the general recommendation is not to use com.sun.* classes directly because they are part of a "Sun proprietary API and may be removed in a future release".
Here is a quick adaptation of an example on sun.com http://java.sun.com/developer/JDCTechTips/2004/tt0217.html. Though it probably needs to be modified to account for the available quality settings.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959787#M87685
Apr 29, 2008
Apr 29, 2008
Copy link to clipboard
Copied
-==cfSearching==
Good point re using com.sun.* classes, I've updated the code to use imageIO for jpegs too, as per your adaptation from the sun example (with some very minor changes).
btw, I haven't taken account of the "available" quality settings because having looked at the api reference, it seems that ImageWriteParam.setCompressionQuality() will take any float between 0 and 1. The array of floats returned by getCompressionQualityValues() seems to provide a set of values that can be used as part of a user interface when setting compression quality values, rather than a list of the supported compression quality values.
Good point re using com.sun.* classes, I've updated the code to use imageIO for jpegs too, as per your adaptation from the sun example (with some very minor changes).
btw, I haven't taken account of the "available" quality settings because having looked at the api reference, it seems that ImageWriteParam.setCompressionQuality() will take any float between 0 and 1. The array of floats returned by getCompressionQualityValues() seems to provide a set of values that can be used as part of a user interface when setting compression quality values, rather than a list of the supported compression quality values.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959788#M87686
Apr 29, 2008
Apr 29, 2008
Copy link to clipboard
Copied
markthickpaddy,
Yes, you are right about getCompressionQualityValues(). I was rushing to a meeting and did not look closely at that one. After further reading, the api does mention those values can be used for interface options like "Good", "Better", and "Best".
Yes, you are right about getCompressionQualityValues(). I was rushing to a meeting and did not look closely at that one. After further reading, the api does mention those values can be used for interface options like "Good", "Better", and "Best".
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959789#M87687
May 01, 2008
May 01, 2008
Copy link to clipboard
Copied
markthickpaddy,
I went to incorporate the two code snippets into a function and noticed something strange. If the ImageWrite fails, it appears to do something "wonky" to the destination file. Even though the subsequent ImageIO code runs without error, the final image file is still locked somehow or left in an unfinished state. Now considering that the original ImageWrite action did fail, perhaps this should make sense to me. But it is not the behavior I was expecting.
If I try and view the final image (with xp's picture viewer), the preview is blank. Try and open the image with another program, I get a sharing violation: "A sharing violation occurred while accessing: <path to saved image file>". However, once I bounce the CF server, the problem goes away. The image can be previewed and opened with another program.
Once I removed ImageWrite from the function entirely, the save works perfectly. So the problem is definitely related to ImageWrite.
Anyway, here is my final function code (without ImageWrite)
I went to incorporate the two code snippets into a function and noticed something strange. If the ImageWrite fails, it appears to do something "wonky" to the destination file. Even though the subsequent ImageIO code runs without error, the final image file is still locked somehow or left in an unfinished state. Now considering that the original ImageWrite action did fail, perhaps this should make sense to me. But it is not the behavior I was expecting.
If I try and view the final image (with xp's picture viewer), the preview is blank. Try and open the image with another program, I get a sharing violation: "A sharing violation occurred while accessing: <path to saved image file>". However, once I bounce the CF server, the problem goes away. The image can be previewed and opened with another program.
Once I removed ImageWrite from the function entirely, the save works perfectly. So the problem is definitely related to ImageWrite.
Anyway, here is my final function code (without ImageWrite)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959783#M87681
Apr 28, 2008
Apr 28, 2008
Copy link to clipboard
Copied
i confirm exact same error.
cf8.1
installed updates: hf801-71471.jar, hf801-71557.jar
jre: 1.5.0.15
error:
type: javax.imageio.IIOException
message: Quantization table 0x02 was not defined
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
cf8.1
installed updates: hf801-71471.jar, hf801-71557.jar
jre: 1.5.0.15
error:
type: javax.imageio.IIOException
message: Quantization table 0x02 was not defined
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959790#M87688
May 02, 2008
May 02, 2008
Copy link to clipboard
Copied
You could try messing about with temporary files to work
around this - have imageWrite write to a temp file and if it
succeeds, move the file to the destination, if it fails, try to
delete it (which might fail, but what the hell). As far as I
recall, imageCFC does this.
I like the idea of trying CF's imageWrite function first, but that's just because I'm assuming that there is some good reason why adobe chose not to use ImageIO to write the images (performance, support for more jpeg sub-types, I dunno).
I like the idea of trying CF's imageWrite function first, but that's just because I'm assuming that there is some good reason why adobe chose not to use ImageIO to write the images (performance, support for more jpeg sub-types, I dunno).
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959791#M87689
May 02, 2008
May 02, 2008
Copy link to clipboard
Copied
markthickpaddy,
Yes, the ideal would be to use ImageWrite. However, there are several issues that appear to be related to ImageWrite, not just this one.
I did try the temp file idea, but the failed image file generated by ImageWrite could not be deleted. Not that surprising considering the "sharing violation" error I received earlier when trying to open the image with another program.
I do not know what ImageWrite uses behind the scenes. Just that there seems to be a difference between the method it uses and the one used here. Due to the fact that there are multiple issues related to ImageWrite, I am sticking with the function above for now. I will replace it with ImageWrite once the issues are resolved.
Yes, the ideal would be to use ImageWrite. However, there are several issues that appear to be related to ImageWrite, not just this one.
I did try the temp file idea, but the failed image file generated by ImageWrite could not be deleted. Not that surprising considering the "sharing violation" error I received earlier when trying to open the image with another program.
I do not know what ImageWrite uses behind the scenes. Just that there seems to be a difference between the method it uses and the one used here. Due to the fact that there are multiple issues related to ImageWrite, I am sticking with the function above for now. I will replace it with ImageWrite once the issues are resolved.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959792#M87690
May 07, 2008
May 07, 2008
Copy link to clipboard
Copied
Updated hot fix was published today. Visit
http://www.adobe.com/go/kb402604
for list of all CF8/8.01 hot fixes. Again, the CFImage hot fix was
updated today (5/7/08).
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959793#M87691
May 07, 2008
May 07, 2008
Copy link to clipboard
Copied
This patch fixed the problem. Thanks for the quick
response.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959794#M87692
May 07, 2008
May 07, 2008
Copy link to clipboard
Copied
hans blix wrote:
<i>This patch fixed the problem. Thanks for the quick response.</i>
+1
<i>This patch fixed the problem. Thanks for the quick response.</i>
+1
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959795#M87693
May 08, 2008
May 08, 2008
Copy link to clipboard
Copied
There are two problems mentioned within this topic, the
"Quantization table 0x02 was not defined" error with some jpegs and
the file locking issue.
Can anyone confirm that both of these issues are resolved by installing the hot fix? I have three cf8 servers to look after and have to schedule downtime with customers to install a hot fix - I want to be sure it's worth the hassle.
Thanks
Mark
Can anyone confirm that both of these issues are resolved by installing the hot fix? I have three cf8 servers to look after and have to schedule downtime with customers to install a hot fix - I want to be sure it's worth the hassle.
Thanks
Mark
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959796#M87694
May 08, 2008
May 08, 2008
Copy link to clipboard
Copied
markthickpaddy,
There were a total of four issues, across several different threads:
1. Quantization table 0x02 was not defined (this thread)
2. Image files locked on error (this thread)
3. Missing Huffman code table entry
4. Files get locked by cfimage, can't delete them
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1355060
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=3&threadid=1356442
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1355471
So far the updated hotfix (dated 05/07/2008) has fixed all (4) of the issues for me. I noticed hans blix marked all of his threads as answered. So I would guess the hotfix worked for him as well, but confirm it with him.
There were a total of four issues, across several different threads:
1. Quantization table 0x02 was not defined (this thread)
2. Image files locked on error (this thread)
3. Missing Huffman code table entry
4. Files get locked by cfimage, can't delete them
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1355060
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=3&threadid=1356442
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=1355471
So far the updated hotfix (dated 05/07/2008) has fixed all (4) of the issues for me. I noticed hans blix marked all of his threads as answered. So I would guess the hotfix worked for him as well, but confirm it with him.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959797#M87695
May 08, 2008
May 08, 2008
Copy link to clipboard
Copied
I've confirmed the fix for all these issues too.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959798#M87696
May 08, 2008
May 08, 2008
Copy link to clipboard
Copied
Great news, thanks for responding.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Beginner
,
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959799#M87697
Jun 13, 2008
Jun 13, 2008
Copy link to clipboard
Copied
I confirmed too. hf801-71557.zip kb403411 fixed this issue
but not the cumulative ColdFusion 8.0.1 cumulative hot fix
1.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
LATEST
/t5/coldfusion-discussions/yet-another-cfimage-bug/m-p/959800#M87698
Sep 14, 2008
Sep 14, 2008
Copy link to clipboard
Copied
Yes the fix works for me!
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

