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
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 martin.schubert@informatik.uni-ulm.de:
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@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
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 martin.schubert@informatik.uni-ulm.de:
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@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Seaside mailing list Seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
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.
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@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
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 Seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
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'.
Hi!
Martin Schubert martin.schubert@informatik.uni-ulm.de 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
goran@krampe.se 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.).
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:
goran@krampe.se 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 Seaside@lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
seaside@lists.squeakfoundation.org