[Seaside] serve jpg image files from form objects
m.bany at wanadoo.fr
Thu Jun 1 06:40:06 UTC 2006
Martin Schubert a écrit :
> i want to serve a jpg-file which is stored in a Form object.
> so i do : aForm _ (Form fromFileNamed: 'wave.jpg')
Method #fromFileNamed: is smart enough to decode various picture formats
and turn them into bitmaps. That's why it can understand your jpeg file.
after this was executed, the knowledge that its source was jpeg is lost.
Not so smart.
> this doesn`t work, and when i am acceptin the following, seaside
> seems to convert the jpg file to gif or wracks up the picture file
> somehow :
> html imageWithDocument: aForm
> mimeType: 'image/jpeg'
> fileName: root name,'Picture', '.jpg'.
The above creates a document handler. When invoked for the rendering,
this document handler
needs to encode the bitmap into a MIME document. For some reason, the
is selected by Seaside. See Form>>asMIMEDocument.
A possible solution would be to subclass Form so that it remembers the
its source, re-implementing #asMIMEDocument to take this into account.
Another solution may be to use the Canvas api, where the image tag is
More information about the Seaside