Jon, I'm hear to second your request. I got sick of the blatant XHTML standards violation here, so I edited Image.py, commenting out lines 748 and 749. Anyway, that fixes the direct call method. I got sick of editing source code for all the installs (and to lazy to make a HotFix/Monkey Patch - religous debate anyone?), so for ZPT, I started using this when I didn't want to hard code it: <img tal:define="image python:getattr(here.img,'guests_logo.png')" tal:attributes="src image/absolute_url; height image/height; width image/width; alt image/title_or_id" style="border: 0;"> This works for an image guests_logo.png stored in a subfolder img. HTH, Troy Jon Whitener wrote:
Zopers:
How can I manipulate the attributes that are included when I insert a ZPT-rendered image tag, for CSS reasons? (I hope there's a way to do this in the page template.) Specifically, I want to keep the WIDTH, HEIGHT, and ALT attributes as they render dynamically, but add a CLASS attribute, and get rid of the BORDER attribute.
Currently, the ZPT code:
<div tal:replace="structure here/menu_icon">MENU ICON</div>
renders as:
<img src="http://localhost:8080/menu_icon" alt="Stub Menu Icon" height="69" width="92" border="0" />
I'm glad the WIDTH and HEIGTH are included automagically, but how can I:
- Insert a CLASS attribute, e.g. class="menu-icon"? - Leave out the BORDER attribute? I don't know how that got in there.
Is there some way to add a class="menu-icon" attribute in the tag? If I really must break it down into:
<img src="IMG SRC" class="menu-icon" tal:attributes="src here/menu_icon/absolute_url" />
Then, how do I include the ALT, WIDTH and HEIGHT attributes into the tag, without hard-coding them?
BTW { I found in the docs about the
tag(height=None, width=None, alt=None, scale=0, xscale=0, yscale=0, **args)
method of an Image object, but I have no idea how to access or modify that stuff. If this is necessary, please provide details. }
Thanks in advance, Jon Whitener Detroit MI, USA