RE: Insert PNG File from Servlet no go

Andrew Watson <[email protected]> Fri, 24 Jan 2003 09:04:21 +1100
Newsgroups gmane.comp.java.jgenerator.devel
Message-ID <[email protected]>
It would seem that when you try to add a png file, it doesn't go by the file extension, but the first four bytes in the stream..

b0 == 0x89 && b1 == 0x50 && b2 == 0x4e && b3 == 0x47

If the first four bytes are not those, then you will get the error you describe.  
It should be easy enough for you to verify that they are.

Andrew

-----Original Message-----
From:	William L. Thomson Jr. [SMTP:[email protected]]
Sent:	Thursday, January 23, 2003 12:02 PM
To:	JGen Devel
Subject:	[Jgen-devel] Insert PNG File from Servlet no go

To all,
	In the past I have mostly dealt with JPEGs and have not run into this
problem. I am trying to use the Insert PNG File to insert a PNG that is
stored in a blob format in a database. 

	I have a servlet that I have been using for JPEG's, and it serves up
the PNG just fine. However JGenerator does not like the servlet
generated PNGs?

	I get the following exception

2003-01-22 13:22:35,172 [INFO] - Retrieving content of
http://www.obsidian-studios.com/servlet/Picture
2003-01-22 13:22:35,173 [ERROR] - Error occured in file
'/home/sites/home/web/sw-bin/picture.swt', movie clip 'null', frame '1',
command 'InsertPngFileCommand'
com.iv.flash.util.IVException: Unsupported media file
'http://www.obsidian-studios.com/servlet/Picture'
        at
com.iv.flash.api.FlashFile.addExternalMedia(FlashFile.java:342)
        at
com.iv.flash.api.FlashFile.addExternalMedia(FlashFile.java:366)
        at
com.iv.flash.commands.InsertPngFileCommand.doCommand(InsertPngFileCommand.java:77)
        at com.iv.flash.api.Frame.doCommand(Frame.java:374)


I have removed the servlet params that are used to retrieve the PNG
image.

Now I am simply using the PrintWriter to write out png data, and the
content type has been set to image/png.

Basically my servlet is the same for JPEG, PNG, and GIFS. I just simply
change the content type

image/jpeg
image/png
image/gif

I have not tried GIFs yet. Hopefully I will not run into this problem
with them?

Any comments? Ideas? Thoughts?

-- 
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone  707.766.9509
Fax    707.766.8989
http://www.obsidian-studios.com



-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
_______________________________________________
Jgen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jgen-devel

__________ Information from NOD32 1.349 (20030120) __________

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com





-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com