[Zope] Re: store an image within a session

clebert thibault clebert_thibault@yahoo.com
Tue, 10 Jun 2003 08:19:08 -0700 (PDT)


Thank you very much for your answer Troy,
but I have still problems with your fourth step
(the img tag), because I'd like to display the image
from a DTML document not from a page template.

Obviously, something like: 
     <dtml-var data_of_the_jpeg_file> 
doesn't dsiplay an image but the content of the jpeg
file, so do you know how to fix this problem?



--- Troy Farrell <troy@entheossoft.com> wrote:
> This is an interesting request.  Almost certainly,
> you do not want to do 
> this, but if you do, you will want to
> 
> 1) verify you have a session object
> (REQUEST['SESSION'] by default)
> 2) store your data there (REQUEST.SESSION.jpg_image
> = 
> '^JPEGNONPRINTABLECHARSHEREk...'
> 3) create a python script that returns the image:
> 
> if REQUEST['SESSION'].has_key('jpg_image'):
>    img = REQUEST.SESSION.jpg_image
> else:
>    img = container.substitute_image.data
> 
> return img
> 
> 4) call the method from an img tag:
> <img alt="my image stored in a session"
> src="python_script_name" />
> Note that you'll have to calculate height and width
> on your own...
> 
> That's a rough guess.  It won't work without some
> messing around, but 
> that's how I would approach such a challenge.  I
> hope your server has a 
> decent amount of RAM :)
> 
> Troy
> 
> Oliver Bleutgen wrote:
> > Please do not mail me personally, mail to the zope
> list instead (I have 
> > CC'd it), especially since I know nothing about
> sessions.
> > 
> > clebert_thibault wrote:
> > 
> >> Hi Sir!
> >>
> >> Do you know how to store the content of a jpeg
> file for instance
> >> within a session, then display this content of a
> jpeg file as an
> >> image?
> >>
> >> Thank you very much for your help,
> >>
> >> Tibo.
> >>
> > 
> > 
> > cheers,
> > oliver
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com