[Zope] Images Properties

Martijn Pieters mj@antraciet.nl
Wed, 04 Aug 1999 11:42:14 +0200


At 08:31 04/08/99 , Michael Fox wrote:
>Hi,
>
>I'm new to Zope. My question is once I have added an image in Zope. Why
>when I refer to that object in a template the width and height are not
>in the code?
>
>How do I go about doing this? other than specify the height, width etc
>in <IMG SRC="MyImage" Width="1"....etc
>
>can anyone help me?
>
>- Mike

First: what version of Zope are you using?

Second: Depending on the version you are using, Image objects figure out 
the width and height of an image when it is uploaded and store these as 
properties on the Image object. Older versions of Zope don't do this at 
all, slightly less old versions only do it with GIF and PNG images, and the 
newer versions do JPEG as well.

You can check wether or not this autodetection has occurred by looking at 
the properties tab of the image. If the width and height are not present, 
you can fill them in by hand.
Any call to the image object (like with <!--#var MyImage-->) will then 
include the width and height.

 From Zope 2.0b1 you can also call the 'tag' method on the image object, 
specifying the width and height that should be in the IMG tag generated, or 
specify that no with or height attributes should be present: <dtml-var 
"MyImage.tag(width='', height='')"> will get you a IMG tag that won't have 
width and height attributes.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------