[Zope] Re: store an image within a session

clebert thibault clebert_thibault@yahoo.com
Wed, 11 Jun 2003 02:29:47 -0700 (PDT)


That's true, the expression <img alt="..." src="...">
is plain HTML, but in my case if you write the
following thing in a DTML document:

    <img  src="name_of_a_python_script">

the browser doesn't call the python script to display
the image.
How can I put this problem right?

Many thanks,
Tibo.

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

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