serve jpg image files from form objects

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

serve jpg image files from form objects

mtin79
hello out there,
allthough i browsed throught the archives i couldn`t find the answer  
to my problem.

i want to serve a jpg-file which is stored in a Form object.
so i do : aForm _ (Form fromFileNamed: 'wave.jpg')

then i tried the following inside the #renderContentOn:  method :
       
html imageWithDocument: aForm bits asByteArray
                mimeType: 'image/jpeg'
                fileName: root name,'Picture', '.jpg'.

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'.

anybodys having some experience with this issue?
thanks for help!

martin

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: serve jpg image files from form objects

Boris Popov, DeepCove Labs (SNN)
Here's what I did to serve PNG files from VisualWorks,

(html anchor)
 attributeAt: 'rel' put: 'lightbox';
 callback: [self session
                returnResponse: (WADocumentHandler
                                document: self pngImageBytes
                                mimeType: 'image/png'
                                fileName: 'image.png') response];
                with: [(html image)
                                style: 'border: none; padding: 0px;';
                                url: (self pictures addToPath: 'view.png');
                                altText: 'View']

Hope this helps,

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Martin
Schubert
Sent: Wednesday, May 31, 2006 12:30 PM
To: [hidden email]
Subject: [Seaside] serve jpg image files from form objects

hello out there,
allthough i browsed throught the archives i couldn`t find the answer  
to my problem.

i want to serve a jpg-file which is stored in a Form object.
so i do : aForm _ (Form fromFileNamed: 'wave.jpg')

then i tried the following inside the #renderContentOn:  method :
       
html imageWithDocument: aForm bits asByteArray
                mimeType: 'image/jpeg'
                fileName: root name,'Picture', '.jpg'.

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'.

anybodys having some experience with this issue?
thanks for help!

martin

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

Philippe Marschall
In reply to this post by mtin79
Hi

If you want to do this with FileLibrary
- Load the latest FileLibrary from the Seaside repository at SqueakSource
- go to your /seaside/config application and make sure there's an
application of the type "Static File Library" named files (should
happen automatically if you load FileLibrary-pmm.8 and had no previous
version loaded)
- create a subclass of WAFileLibrary named let's say MyFileLibrary
- configure the files application, again in the  /seaside/config application
- add MyFileLibrary and configure it too
- add/upload your 'wave.jpg' file (might take a moment)
- in your seaside application you can use the following code

html image: '/files/wave.jpg'

You can check in MyFileLibrary into Monticello, file it out, make a
changeset, .... it will take 'wave.jpg' everywhere it goes.

Cheers
Philippe

2006/5/31, Martin Schubert <[hidden email]>:

> hello out there,
> allthough i browsed throught the archives i couldn`t find the answer
> to my problem.
>
> i want to serve a jpg-file which is stored in a Form object.
> so i do : aForm _ (Form fromFileNamed: 'wave.jpg')
>
> then i tried the following inside the #renderContentOn:  method :
>
> html imageWithDocument: aForm bits asByteArray
>                 mimeType: 'image/jpeg'
>                 fileName: root name,'Picture', '.jpg'.
>
> 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'.
>
> anybodys having some experience with this issue?
> thanks for help!
>
> martin
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: (serve/) RENDER jpg image files from form objects

Martin Schubert
hey philippe,
thanks for reply. i allready had a look at the FileLibrary. i like  
it! but i want to save the jpg or png files or any kind of multimedia  
data directly in the data objects which get rendered.
so there is an instance of type 'Form' and which holds an jpg picture  
file. everything works perfect with gifs. but as soon as jpgs or png  
or other mime type come into the game its getting difficult.

i want the jpeg file (hold in a instance variable of type form) to be  
RENDERED. not only a link to the data.

>> html imageWithDocument: aForm bits asByteArray
>>                 mimeType: 'image/jpeg'
>>                 fileName: root name,'Picture', '.jpg'.

best

martin


Am 31.05.2006 um 22:37 schrieb Philippe Marschall:

> Hi
>
> If you want to do this with FileLibrary
> - Load the latest FileLibrary from the Seaside repository at  
> SqueakSource
> - go to your /seaside/config application and make sure there's an
> application of the type "Static File Library" named files (should
> happen automatically if you load FileLibrary-pmm.8 and had no previous
> version loaded)
> - create a subclass of WAFileLibrary named let's say MyFileLibrary
> - configure the files application, again in the  /seaside/config  
> application
> - add MyFileLibrary and configure it too
> - add/upload your 'wave.jpg' file (might take a moment)
> - in your seaside application you can use the following code
>
> html image: '/files/wave.jpg'
>
> You can check in MyFileLibrary into Monticello, file it out, make a
> changeset, .... it will take 'wave.jpg' everywhere it goes.
>
> Cheers
> Philippe
>
> 2006/5/31, Martin Schubert <[hidden email]>:
>> hello out there,
>> allthough i browsed throught the archives i couldn`t find the answer
>> to my problem.
>>
>> i want to serve a jpg-file which is stored in a Form object.
>> so i do : aForm _ (Form fromFileNamed: 'wave.jpg')
>>
>> then i tried the following inside the #renderContentOn:  method :
>>
>> html imageWithDocument: aForm bits asByteArray
>>                 mimeType: 'image/jpeg'
>>                 fileName: root name,'Picture', '.jpg'.
>>
>> 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'.
>>
>> anybodys having some experience with this issue?
>> thanks for help!
>>
>> martin
>>
>> _______________________________________________
>> Seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

Martin Schubert
In reply to this post by Boris Popov, DeepCove Labs (SNN)
hey boris,
thanks for your answer and code example. 
i am not clearly about if you just provide a link to the file or if you get it rendered to the website.
especially the message : 'self pngImageByte' ! does it return a ByteArray?

WADocumentHandler 
document: self pngImageBytes
mimeType: 'image/png'
fileName: 'image.png') response

because thats what i thought the message : 'aForm bits asByteArray' is doing :

html imageWithDocument: aForm bits asByteArray
                mimeType: 'image/jpeg'
                fileName: root name,'Picture', '.jpg'.

does anyone know how these methods are meant to be used? or is there some strange conversion problem from Form -> bits -> asByteArray?

best

martin

i want the jpeg file (hold in a instance variable of type form) to be RENDERED. not only a link to the data.



Am 31.05.2006 um 22:38 schrieb Boris Popov:

Here's what I did to serve PNG files from VisualWorks,

(html anchor)
 attributeAt: 'rel' put: 'lightbox';
 callback: [self session 
returnResponse: (WADocumentHandler 
document: self pngImageBytes
mimeType: 'image/png'
fileName: 'image.png') response];
with: [(html image)
style: 'border: none; padding: 0px;';
url: (self pictures addToPath: 'view.png');
altText: 'View']

Hope this helps,

-Boris

-- 
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5


CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
[[hidden email]] On Behalf Of Martin
Schubert
Sent: Wednesday, May 31, 2006 12:30 PM
Subject: [Seaside] serve jpg image files from form objects

hello out there,
allthough i browsed throught the archives i couldn`t find the answer  
to my problem.

i want to serve a jpg-file which is stored in a Form object.
so i do : aForm _ (Form fromFileNamed: 'wave.jpg')

then i tried the following inside the #renderContentOn:  method :


html imageWithDocument: aForm bits asByteArray
mimeType: 'image/jpeg'
fileName: root name,'Picture', '.jpg'.

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'.

anybodys having some experience with this issue?
thanks for help!

martin

_______________________________________________
Seaside mailing list
_______________________________________________
Seaside mailing list


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: serve jpg image files from form objects

Boris Popov, DeepCove Labs (SNN)
In reply to this post by mtin79
Oh I see, sorry, this would prompt the user to download a file, not quite
what you had in mind.

Cheers!

-Boris

--
+1.604.689.0322
DeepCove Labs Ltd.
4th floor 595 Howe Street
Vancouver, Canada V6C 2T5

[hidden email]

CONFIDENTIALITY NOTICE

This email is intended only for the persons named in the message
header. Unless otherwise indicated, it contains information that is
private and confidential. If you have received it in error, please
notify the sender and delete the entire message including any
attachments.

Thank you.

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Martin
Schubert
Sent: Wednesday, May 31, 2006 3:20 PM
To: The Squeak Enterprise Aubergines Server - general discussion.
Subject: Re: [Seaside] serve jpg image files from form objects

hey boris,
thanks for your answer and code example.
i am not clearly about if you just provide a link to the file or if you get
it rendered to the website.
especially the message : 'self pngImageByte' ! does it return a ByteArray?


        WADocumentHandler
        document: self pngImageBytes
        mimeType: 'image/png'
        fileName: 'image.png') response


because thats what i thought the message : 'aForm bits asByteArray' is doing
:


                html imageWithDocument: aForm bits asByteArray
                                mimeType: 'image/jpeg'
                                fileName: root name,'Picture', '.jpg'.


does anyone know how these methods are meant to be used? or is there some
strange conversion problem from Form -> bits -> asByteArray?

best

martin

i want the jpeg file (hold in a instance variable of type form) to be
RENDERED. not only a link to the data.




Am 31.05.2006 um 22:38 schrieb Boris Popov:


        Here's what I did to serve PNG files from VisualWorks,

        (html anchor)
         attributeAt: 'rel' put: 'lightbox';
         callback: [self session
        returnResponse: (WADocumentHandler
        document: self pngImageBytes
        mimeType: 'image/png'
        fileName: 'image.png') response];
        with: [(html image)
        style: 'border: none; padding: 0px;';
        url: (self pictures addToPath: 'view.png');
        altText: 'View']

        Hope this helps,

        -Boris

        --
        +1.604.689.0322
        DeepCove Labs Ltd.
        4th floor 595 Howe Street
        Vancouver, Canada V6C 2T5

        [hidden email]

        CONFIDENTIALITY NOTICE

        This email is intended only for the persons named in the message
        header. Unless otherwise indicated, it contains information that is
        private and confidential. If you have received it in error, please
        notify the sender and delete the entire message including any
        attachments.

        Thank you.

        -----Original Message-----
        From: [hidden email]
        [mailto:[hidden email]] On Behalf Of
Martin
        Schubert
        Sent: Wednesday, May 31, 2006 12:30 PM
        To: [hidden email]
        Subject: [Seaside] serve jpg image files from form objects

        hello out there,
        allthough i browsed throught the archives i couldn`t find the answer

        to my problem.

        i want to serve a jpg-file which is stored in a Form object.
        so i do : aForm _ (Form fromFileNamed: 'wave.jpg')

        then i tried the following inside the #renderContentOn:  method :

       
       

        html imageWithDocument: aForm bits asByteArray
        mimeType: 'image/jpeg'
        fileName: root name,'Picture', '.jpg'.

        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'.

        anybodys having some experience with this issue?
        thanks for help!

        martin

        _______________________________________________
        Seaside mailing list
        [hidden email]
        http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
        _______________________________________________
        Seaside mailing list
        [hidden email]
        http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

Michel Bany-3
In reply to this post by mtin79
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.

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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

Göran Krampe
In reply to this post by mtin79
Hi!

Martin Schubert <[hidden email]> wrote:
> hello out there,
> allthough i browsed throught the archives i couldn`t find the answer  
> to my problem.

As perSeaside2.6a3-avi.7 (21 January 2006, 8:10:38 pm), Avi merged my
WACachedDocument class into Seaside, and this is the class comment:
------------------
This class is for serving smallish files like PNG images etc using
WADocumentHandler. Using the Canvas API for HTML generation you simply
do this:

        html image fileName: 'myimage.png'

or:

        html image fileName: 'myimage.blurp' mimeType: 'blurp'

This will create a request handler in your WAApplication registry that
is accessible on a unique URL and does not expire.
The actual contents of the file will only be read upon first access, we
could augment this class with smarter caching, like checking the
modification time on disk.

The class has a Cache class var holding a Dictionary of created
instances so you can clear and preload files into the image using:

        WACachedDocument
                clearCache;
                fileName: 'myimage.png';
                fileName: 'another.gif'; "etc"
                preloadCache

---------------------

cheers, Göran
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

Michel Bany-3
[hidden email] a écrit :

>do this:
>
> html image fileName: 'myimage.png'
>
>or:
>
> html image fileName: 'myimage.blurp' mimeType: 'blurp'
>
>  
>

The Seaside2.6b1 branch (that includes everything from 2.6a3) also
supports this :

        html image fileName: 'myimage.blurp' mimeType: 'blurp' document: aDocument

where the additional argument is anything that can understand #asMIMEDocument
(String, ByteArray, Form, CachedDocument, etc.).




_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

mtin79
In reply to this post by Michel Bany-3

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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

Martin Schubert
In reply to this post by Michel Bany-3
hey,
again in this case i  think the #asMIMEDocument seems to be the  
bottleneck becaus Form looses its sense what type of image it was and  
the ByteArray generated via 'aForm bits asByteArray' is not working  
when i have following in the #renderContentOn: method :

html imageWithDocument: aForm bits asByteArray
         mimeType: 'image/jpeg'
         fileName: root name.


Am 01.06.2006 um 09:53 schrieb Michel Bany:

> [hidden email] a écrit :
>
>> do this:
>>
>> html image fileName: 'myimage.png'
>>
>> or:
>>
>> html image fileName: 'myimage.blurp' mimeType: 'blurp'
>>
>>
>
> The Seaside2.6b1 branch (that includes everything from 2.6a3) also  
> supports this :
>
> html image fileName: 'myimage.blurp' mimeType: 'blurp' document:  
> aDocument
>
> where the additional argument is anything that can understand  
> #asMIMEDocument
> (String, ByteArray, Form, CachedDocument, etc.).
>
>
>
>
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: serve jpg image files from form objects

Bany, Michel
In reply to this post by mtin79
> asMIMEDocument
> | aStream |
> aStream _ (RWBinaryOrTextStream on: '').
> JPEGReadWriter putForm: (self asFormOfDepth: self depth)
onStream:  aStream.
> ^MIMEDocument contentType: 'image/jpeg' content: aStream
contents
 
I think you should use JPEGReadWriter2 rather than JPEGReadWriter.
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: serve jpg image files from form objects

mtin79

> I think you should use JPEGReadWriter2 rather than JPEGReadWriter.

hm. JPEGReadWriter2 needs a plugin which i can`t find anywhere. this  
seems to become a long ride through the squeak environment. does  
anybody have the plugin? (i am using mac os x intel with latest  
stable 3.8 version)

> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Solution to problem : serve jpg image files from form objects

mtin79
In reply to this post by Michel Bany-3
Hello out there,
finally after hours on end i finally found (with the help of mb) the  
solution to the problem :
i subclassed Form with FormXTD and overwrote the method  
#asMIMEDocument with the following method:

asMIMEDocument
        | aStream |
        aStream _ (RWBinaryOrTextStream on: '').
        JPEGReadWriter2 putForm: (self asFormOfDepth: self depth) onStream:  
aStream.
        ^MIMEDocument contentType: 'image/jpeg' content: aStream contents.

but this didn`t work. than i realized that the new method was never  
called but only the original method in Form. because the construct :  
FormXTD fromFileNamed: 'x.jpeg' created an instance of Form and not  
of FormXTD because the class method is invoked on Form class and not  
inherited to FormXTD. so i will finally restart learning the  
inheritance mechanism in smalltalk. so for a quick hack, just take  
the previous method and substitute the Form>>asMIMEDocument method  
with it.

good night





> 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.
>
> 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Solution to problem : serve jpg image files from form objects

Michel Bany-3

> because the construct :  FormXTD fromFileNamed: 'x.jpeg' created an
> instance of Form

I had a quick look, and yes, I agree, subclassing Form is quite a challenge.

> so for a quick hack, just take  the previous method and substitute the
> Form>>asMIMEDocument method  with it.
>

Rather than hacking, you may want to try something like this

html imageWithDocument: aForm asMIMEDocumentOfTypeJPEG
        mimeType: 'image/jpeg'
        fileName: root name,'Picture', '.jpg'.

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside