[Zope] Re: Please help with Rendering Images in DTML

Maik Jablonski maik.jablonski@uni-bielefeld.de
Sun, 26 Jan 2003 14:58:28 +0100


Gary Speer wrote:
> In a DTML method, a string is constructed in a variable that is the relative
> URL of an Image.
> For example ...
> <dtml-let MyImageId="'folder/subfolder/myimage.jpg'">
> 
> using
> <dtml-var MyImageId>  results in just the string being returned
> a hand constructed image tag like
> <img src=<dtml-var MyImageID> alt="">
> will render the desired image, but does not provide access to its 'Image
> object' attributes like height and width.

Hi,

you can get every object via an url with restrictedTraverse. Then you 
can access the properties of the object...

Example:

<dtml-with "restrictedTraverse('folder/subfolder/myimage.jpg')">
<dtml-var title_or_id>: <dtml-var height>, <dtml-var width>
</dtml-with>

Cheers, Maik