On Mon, Aug 07, 2000 at 11:21:53AM -0300, Performance.net Strategic Internet Solutions
> I am writing a python product and want to display a GIF file in some of the
> manage_pages. It is not meant to be the "icon" property of the class, just
> an image to be included in DTML. I included it in my class as follows:
> chooser = ImageFile('images/chooser.gif',globals()),
> but when I call it in DTML (<dtml-var chooser>) I get the following:
> <ImageFile instance at 014F1D90>
> I thought maybe I could use an instance of the Image class:
> chooser = OFS.Image('images/chooser.gif',globals()),
> but this doesn't seem to work.
> How do you create an instance of an Image in a Python Product?
ImageFile objects do not (like ZODB stored Image objects) generate an IMG tag
when called. Image object, when called, generate an IMG tag that points the
browser to the correct address to retrieve tha actual image.
With an ImageFile object, you need to construct the tag yourself. If this
class has an instance foo, with this ImageFile attribute chooser, and the
instance foo is stored in the root of your Zope ZODB, you need to point the
browser to http://yoursever/foo/chooser. So your DTML needs to generate the
I don't know enough about your DTML, but if it is another attribute of the
same class, you could use one of the URLx REQUEST variables or something to
construct the URL for the image. Also, absolute_url() called on the foo
instance may also work for a base URL.
Hope this helps.
| Software Engineer mailto:[EMAIL PROTECTED]
| Digital Creations http://www.digicool.com/
| Creators of Zope http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio
Zope maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -