[Zope] Re: store an image within a session

Troy Farrell troy@entheossoft.com
Tue, 10 Jun 2003 08:59:45 -0500

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 = 
3) create a python script that returns the image:

if REQUEST['SESSION'].has_key('jpg_image'):
   img = REQUEST.SESSION.jpg_image
   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 :)


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