[ZWeb] Image Properties Error

Martijn Pieters mj@zope.com
Mon, 18 Mar 2002 14:15:34 -0500


On Mon, Mar 18, 2002 at 12:15:29PM +0100, Paolo D'Aubert wrote:
> Hi All, I have a little big problem to get image width and height.
>  
> I have a Mysql Db where I store all the names of the images.
> I get the names from the query as my_image
> how to get width and height???
>  
> 'cause if I get <dtml-var "my_image.height"> I got an error...
>  
> I tryed many different things like  <dtml-var "['my_image'].height">, <dtml-var
> "_.['my_image'].height">
> but doesnt works...

The correct usage of the namespace variable is _[name]; so you can get at
the height property of the object named in the variable my_image as:

  _[my_image].height

The ZSP page uses this to correlate an Image named in the ZSP XML file to
the images in the Folder, see:

  http://www.zope.org/Resources/ZSP/index_html/view_source

where we access images named in the LOGO attribute:

  <dtml-var "_[LOGO].tag(alt=COMPANY)">

This code generates an image tag for the Image object in question.

For further Zope related questions, please use the zope@zope.org mailinglist
(subscribe information at http://www.zope.org/Resources/MailingLists); this
list is intended for discussion about the Zope.org website only.

-- 
Martijn Pieters
| Software Engineer  mailto:mj@zope.com
| Zope Corporation   http://www.zope.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------