[Image-SIG] StringIO seems to garble images in cgi

Georg Mischler schorsch@schorsch.com
Sat, 7 Dec 2002 13:48:59 -0500 (EST)


Oops, that was meant to go to the list...

---------- Forwarded message ----------

Fredrik Lundh wrote:

> Doug.Shawhan@gecits.ge.com wrote:
>
> > The following almost works, unfortunately the image comes out garbled. I
> > have tried a variety of images in case they are somehow corrupt- no dice. Am
> > I missing a step?
>
> try saving an image to disk from the browser, and also from within
> the CGI, and compare the files.  if the sizes differ, chances are that
> your server is ignoring the "-u" option on the first line.
>
> </F>
>

> > [...]
> >
> > try:
> >     print 'Content-Type: image/jpeg\n'


Another possibility is that the missing second '\n' here
causes the server to send garbage. You need an empty line
between the HTTP headers and the data.


-schorsch

-- 
Georg Mischler  --  simulations developer  --  schorsch at schorsch.com
+schorsch.com+  --  lighting design tools  --  http://www.schorsch.com/