RE: [Zope-dev] Patch: Add versatile "tag" method to Image
-----Original Message----- From: bruce@perens.com [mailto:bruce@perens.com] Sent: Tuesday, July 13, 1999 3:16 PM To: zope-dev@zope.org Subject: [Zope-dev] Patch: Add versatile "tag" method to Image
The Image class has a str() method that outputs an <IMG ...> tag with an absolute URL, and with the height, width, and alternate text set for you. This is a very efficient way to embed images in your documents, because the page renders better when the height and width of the image are given and you don't have to hard-code them into your document, and the absolute URL uses the web browser's cache efficiently.
However, I found this method constraining in that I could not add attributes such as "BORDER=0" to the tag. This patch adds a more versatile tag() method to Image. Arguments to the tag() method can be any of the usual IMG attributes. Defaults are provided for height and width (again, set from the image file) and For example:
<!--#var "MyImage.tag(border=0, align='CENTER', hspace=2, vspace=2)"-->
... will result in the image being rendered with the given attributes.
Can we get something like this included in the main Zope thread?
Tnanks, this is a good idea. I just checked it in and it will be in the next release (probably beta 1). For CVS users it is there now. -Michel
participants (1)
-
Michel Pelletier