Help on morphs, streams and GIFReadWriters
Giovanni Corriga
valkadesh at libero.it
Mon Dec 8 11:04:47 UTC 2003
Hi
I have this snippet of code:
plot _ PlotMorph new.
st _ FileStream forceNewFileNamed: 'image.gif'.
GIFReadWriter putForm: plot imageForm onStream: st.
st close.
st _ (FileStream fileNamed: 'image.gif') binary.
response at: 'contentType' put: 'image/gif'.
response at: 'content' put: st.
It creates a GIF image from a morph and sends it as a stream as the
content of an http response. The problem is that I have to save the
image to a file and then read it to obtain a stream which Mozilla can
recognize as valid.
I tried setting st to
st _ WriteStream on: ByteArray new
to bypass the file saving+reading, but it doesn't seem to work. What
kind of Stream should I use to solve this?
Thanks,
Giovanni
More information about the Squeak-dev
mailing list
|