Re: [Zope-dev] ZPatterns implementation question: images attributes?

2001-01-13 Thread Steve Alexander

Zope mailing lists wrote:

 I have a specialist (actually, EMarket has a specialist grin) that
 manages objects that from a design point of view I think should have
 a couple of Images as attributes (thumbnail and fullsized images of
 the product).  The question is, how do I implement this using
 ZPatterns?  Currently all of the other object data is pulled from an SQL
 database.  I don't mind storing the Images in the ZODB, but I'm having
 a hard time finguring out how I would implement that.  Pointers or
 alternate design suggestions welcome.

Here's the simplest approach that I can think of.

Stick all your images in a BTree Folder somewhere convenientm like 
/Images. Name all the images "image-NN" where NN is a unique number.

Make a couple of columns in your database (or whatever) for thumbnail_id 
and large_image_id. You'll store the image ids in these.

Use some SkinScript in that Specialist you mentioned that gets the 
thumbnail_id and large_image_id for a particular object, and also makes 
available the thumbnail and large_image.

WITH QUERY get_thumbnail_for_object_SQL(primary_key=self.id) COMPUTE
   thumbnail_id=thumbnail_id,
   thumbnail=Images[thumbnail_id]
OTHERWISE LET
   thumbnail_id='',
   thumbnail=Images.missing_thumbnail

Note here that I could have had just "thumbnail_id," at line 2.
Also, note that I'm assuming you have an image called missing_thumbnail 
in the Images folder.

Do likewise for large images.

This approach assumes that you're not considering images or thumbnails 
to be first-class domain objects in your system, but just attributes of 
your main objects. Thus, you won't be wanting to store other data that 
is pertinent to images. If you do want to do this, you should use a more 
complex design where Images have their own specialist.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] ZPatterns implementation question: images attributes?

2001-01-13 Thread Michael Bernstein

RDM wrote:
 
 I have a specialist (actually, EMarket has a specialist grin) that
 manages objects that from a design point of view I think should have
 a couple of Images as attributes (thumbnail and fullsized images of
 the product).  The question is, how do I implement this using
 ZPatterns?  Currently all of the other object data is pulled from an SQL
 database.  I don't mind storing the Images in the ZODB, but I'm having
 a hard time finguring out how I would implement that.

I've been thinking about my own need for a massive
searchable image archive, and have been wondering if I could
reimplement the ZPhotoAlbum TTW product (which inherits from
ZCatalog and ObjectManager) as a Specialist with a Rack of
Photo objects (Photo is a 'normal' Python Product), but I'm
unsure of how to go about this.

I've also been considering creating an ImageArchive ZClass
that inherits from ZCatalog and BTree folder, so I have
infrastructure that is better suited to managing thousands
(potentially hundreds of thousands) of objects.

Any ideas would be welcome.

Michael Bernstein.

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] ZPatterns implementation question: images attributes?

2001-01-13 Thread Zope mailing lists

On Sat, 13 Jan 2001, Steve Alexander wrote:
 Here's the simplest approach that I can think of.

Thanks, Steve, that's great.  I can even simplify it since there's
a one to one correspondence between products and images, so I can
just use the product Id as the Image Id.  If that correspondence ever
breaks, it'll be a sign that its time to promote the images to
their own specialist...

I think I'm slowly getting the hang of this.  Now, if I can just manage
to finish reading Coad...grin

--RDM


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )