[Zope-PTK] Upload images into ZClass based objects
Chip Vanek
chip@upcast.com
Mon, 20 Mar 2000 17:15:47 -0800
>-----Original Message-----
>From: Mike Pelletier [mailto:mike@digicool.com]
>
>On Mon, 20 Mar 2000, Chip Vanek wrote:
>
>> I just grabbed the latest CVS and see that you moved the DTML files
> and added the image.py & file.py files. I am out of sync and using
>> PTK from Mar 3rd. I will get back into the mainstream and see if those
>> new object meet the need. Do they store the actual file or image in
>> the external file system or in the ZODB?
>
> They store the data in the ZODB. This is unlikely to change.
OK, Then I will start there. Again I am just trying to avoid having
the ZODB grow too fast. Maybe I will look into the use of the PIL
lib to control the actual size of the uploaded image file and create
thumbnails. I think that the PhotoAlbum product does some of this.
>
>> No, I just want to be able to create Portal objects that have
>> imbedded images as an attribute.
>
> Images are almost never stored as simple attributes in Zope. By
>'simple attribute', I mean an attribute which is not itself a Zope
>object. Given that, any Folderish object full of Image
>objects will look
>like an object with Image attributes. Unfortunately, there is
>presently
>no Folderish, PTK-aware object, so if you want something that is both
>content and a container, you'll have to write it. Or, if your
>needs are
>general enough, create a Tracker issue describing them and it might be
>something suitable for the PTK.
>
I think that me needs are rather generic but time will tell. How
do I go about creating my own Folderish object? I need to support
the upload of MS Office files (.ppt, .doc, .xls) that may have
imbedded objects or assosiated image files. I also need to have
each file have a Zope object that controls metadata, access, and
ZCatalog indexing. That could be a simple object that served the
files from the server filesystem or a ZODB folderish object that
contains the uploaded files. WebDAV works for getting the file
up to the ZODB but I do not yet see how to trigger the metadata
collection and indexing activities. The nullresource method in
WebDAV seems to be the right place to start. In what object should
I subclass this method? Has anyone else doe this? I remember seeing
some posting on nullresource but cannot find it now?
>> I think I am just missunderstanding what a ZClass really is. I was
>> assuming that the object that the "*.py" files creates and
>is registered
>> in the portalobject are ZClasses.
>
> A ZClass is a class which is created entierly
>through-the-web. They
>do not exist on the filesystem, but rather in the ZODB.
>(/Control_Panel/Products/aProduct/aZClass) What the various
>PortalContent
>classes do is make themselves available as a ZClass's base
>class, but they
>are not ZClasses.
>
OK, that helps in understanding thinks (I think;) I am just looking
for sample code to model how to move forward. Learning is happening
it is just so painfully slow.
>> I will move to the latest code and try image.py, but I think that
>> it still will not completely meet my needs.
>
> No, not if your needs include serving them from and
>uploading them to
>the filesystem.
>
I will continue to work with JFarr to see if the LocalFS product
can link with the PTK in the longer term. I will share any successes
I have with the list.
>> >def populate_folder(self, filename):
>> > file = open(filename).read()
>> > self.addImage('id', file, 'Title', 'Description of this image')
>
>> Is the "filename" in the code above a path to a file local to
>> the Zope server or local to the users browser? I would like to
>> have the user "upload" a file.
>
> It is a file on the server. You can probably figure out how to
>receive uploads by looking at the Image wizard and add method.
> The wizard
>accepts uploads.
>
Thanks for the tips.
Chip
>Mike.
>
>--
>Mike Pelletier email: mike@digicool.com
>Mild mannered software developer icq: 7127228
>by day, super villain by night. phone: 519-884-2434
>
>