[Zope] Re: store an image within a session

J Cameron Cooper jccooper@jcameroncooper.com
Tue, 10 Jun 2003 13:07:49 -0500


>
>
>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?
>  
>
>>This is an interesting request.  Almost certainly,
>>you do not want to do 
>>this, but if you do, you will want to
>>
>>...
>>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...
>>
You're right -- that's not how it's done in DTML. But pay attention to 
what's going on in the example anyway. That's not a templating language 
of any sort: it's plain HTML. It's making the Python Script the 'src' 
attribute of an 'img' tag. The browser will retrieve and display it.

          --jcc