[Zope] - Image handling - avoiding chaos

Paul Everitt Paul@digicool.com
Sun, 13 Dec 1998 13:40:08 -0500


Brad wrote:
> Do I have to scatter images around the folders? Or can I 
> organize them into
> "images" subfolders and refer to them implicitly?

There's good news and bad news.  _If_ Image objects could handle it, you
could do the following.

Create a top-level folder called Images.  Then, in any Document in the
system, you can say:

<!--#var "Images.mylogo"-->

Now, if you're image happens to have an ID that Python can't grok, for
instance 'mylogo.gif', then that won't work.  An easy alternative is:

<!--#with Images--><!--#var mylogo.gif--><!--#/with-->

Now that bad part.  Zope will do precisely the right thing in the
Document by calling the Image and getting its str representation, thus
inserting:

<img src="mylogo">

into your Document.  Bad thing, though, is that the src is invalid -- it
doesn't go into the Images folder.

There was a discussion here about a hundred messages ago about how to
handle this.  Since I can't even remember yesterday, I don't recall the
answer (something like teaching the Image tag to put its full path in
what is returned maybe...)

--Paul