thumbURL is just a string that contains the path to the image correct? I'm assuming that thumbURL is a metadata element from you ZCatalog right? If this is the case then the information you seek cannot be gotten from the URL unless you traverse it to find the original object. Now traversal is expensive, so you want to do it as seldom as possible. Therefore I suggest that you do it exactly once when the object is cataloged and store the generated image tag as catalog metadata. In order to do this, write a short Python script called something like "thumbTag" with this code in it: thumb = container.restrictedTraverse(context.thumbURL) return thumb.tag(alt=context.caption) Put this Python script somewhere where it can be acquired by the Catalog and all the image objects. Inside the ZCatalog will also work. Now add a metadata element to the ZCatalog with the same name as the Python script (thumbTag). Update your catalog to fill in the metadata. Go to the catalog tab and see if the thumbTag values got filled in (they should contain image tags) Your DTML can now be: <a href="&dtml-imageURL;"><dtml-var thumbTag></a> hth, Casey On Wednesday 29 May 2002 02:26 am, John Schinnerer wrote:
Aloha,
I'm back with an example. My situation seems different than solutions in recent threads, and I don't see how the answers thus far apply (if they do).
I'm looping through the results of a catalog search, displaying thumbnail images, caption, date, etc.. A thumbnail, linked to a full-sized image, is displayed for each result:
... <a href="<dtml-var imageURL>"> <img src="<dtml-var thumbURL>" border="0" alt="<dtml-var caption>"> </a> ...
imageURL and thumbURL are properties of each gallery item which point to the actual image, and will be something like:
/gallery/thumbs/C03Valley001.jpg
I want to get the height and width attributes from each thumbURL item and use them in the img tag attributes. But:
height="<dtml-var thumbURL.height>" does not work, giving:
Error Value: exceptions.KeyError on thumbURL.height in ""
I am assuming this is because in my situation all thumbURL items returned are objects with periods in their IDs. So it's choking on trying to find '/gallery/thumbs/C03Valley001.jpg.height' - is this the case? Or is there some other problem here?
In any case, how do I access the attributes (like height and width) in this situation, where the period in the actual ID is 'implicit' in thumbURL?
thx, John S.