[Seaside] serve jpg image files from form objects
Martin Schubert
martin.schubert at informatik.uni-ulm.de
Thu Jun 1 16:22:15 UTC 2006
Am 01.06.2006 um 08:40 schrieb Michel Bany:
> 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. However
> 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 GIF encoding
> is selected by Seaside. See Form>>asMIMEDocument.
i tried to extend the Form with the following method and some
variations but i cant get it work. it allways renders an image of
type gif and it looks like this as well
asMIMEDocument
| aStream |
aStream _ (RWBinaryOrTextStream on: '').
JPEGReadWriter putForm: (self asFormOfDepth: self depth) onStream:
aStream.
^MIMEDocument contentType: 'image/jpeg' content: aStream contents
so any help on how to fix that would be great.
as far as the html canvas api is concerned i don`t know anything
about it. is there an example about the methods where the rendering
is done. is the #renderContenOn: omitted?
thanks so far !!!
>
> A possible solution would be to subclass Form so that it remembers
> the encoding of
> its source, re-implementing #asMIMEDocument to take this into account.
>
> Another solution may be to use the Canvas api, where the image tag
> is handled quite
> differently.
>
> HTH
> Michel.
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
More information about the Seaside
mailing list