[Zope] Images and dtml-var?

Joel Burton jburton@scw.org
Thu, 5 Apr 2001 10:01:13 -0400 (EDT)


On Thu, 5 Apr 2001, Zopista wrote:

> <dtml-var BlueDot> since Zope parses this into an <img src...> tag. The
> difference should be truly negligble.
> --
>   Andy McKay
> ----- Original Message -----
> From: "Chris Muldrow" <muldrow@mac.com>
> To: <zope@zope.org>
> Sent: Thursday, April 05, 2001 5:37 AM
> Subject: [Zope] Images and dtml-var?
> 
> 
> > OK, hopefully a simple question: I have an image object called BlueDot.
> > We're running Zope behind Apache proxy pass. What takes more system
> > resources to display the image, <dtml-var BlueDot> or <img src="BlueDot>?
> > Or is it the same? Thanks! - Chris


Well, the display of the image is, of couse, the same performance.
But, with the <dtml-var img> syntax, Zope has to parse that, find the
appropriate image object (perhaps acquiring up or down your acquisition
tree), and form the proper tag.

Of course, this also inserts the ALT= text that is the title of the image,
and size and width attributes, which would take you a few minutes to
collect and would force you to enter that manually (and update it!)

I'd say:

  * for ordinary use, go ahead and use <dtml-var img>

  * if you have bazillions of links on a page, or performance is
super-critical, use <img src="">, but remember that you have to keep the
height= width= and alt= attributes up to date yourself.


Of course, one important difference is that if BlueDot gets deleted,
you'll have a Zope error with <dtml-var bluedot>, while <img
src="BlueDot"> will work, you'll just get a broken image link. Depending
on your world view, either of those could be the Right Thing.

-- 
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington