[Zope] ZClasses:
Darran Edmundson
Darran.Edmundson@anu.edu.au
Mon, 20 Sep 1999 20:24:08 +1000
I am working on a folderish Zclass for encapsulating various
incarnations of the same image. For example, instances
of this class might contain a thumbnail, jpegs or gifs
at different resolutions, and maybe even a postscript copy.
To this end, I have created a DImageProduct Product, added
a DImage Zclass derived from the ObjectManager which can only
contain images and files, added title, caption, default
width and height attributes, etc.
I have modified the default DImageClass_addForm method
so that title, caption and a default image can be specified
when DImage objects are added. My addForm method has the
following entry in the form:
<INPUT TYPE="file" NAME="file" SIZE="25" VALUE="">
Therefore, in the DImage constructor (DImageClass_add method)
I have added the following code in an attempt to conditionally
create a default_image if a file was specified:
<!--#with "DImageClass.createInObjectManager(REQUEST['id'], REQUEST)"-->
<dtml-call "REQUEST.set('current_date', ZopeTime())">
<dtml-call "REQUEST.set('date', current_date )">
<dtml-call
"propertysheets.DImageProperties.manage_editProperties(REQUEST)">
<dtml-if file>
<dtml-call "manage_addImage('default_image', file, '')">
</dtml-if>
<!--#/with-->
This does create an Image object but the content is of type
"plain/text" and the size is only 30 bytes (suspiciously close
to the string length of the file specifier). Is it necessary
to create the image object *and* upload the image data in
two separate calls? Presumably "file" in the addImage method
above contains the data stream but I cannot figure out how
to access it (manage_upload(file) doesn't work).
Any help is much appreciated.
Cheers,
Darran.
--
Darran Edmundson [Darran.Edmundson@anu.edu.au]