[Zope] Re: Photo Product fix/question/suggestion

Andrew Lahser andrew@apl-software.com
Mon, 10 Jan 2000 21:00:21 -0500


I'll answer the last first, I have been developing a product called
ZPhotoAlbum which subclasses a ZCatalog to provide full-text, indexed
searches on your online photo database. I hope that the ZPhotoAlbum
will support a property that will be used by ZPhoto (think of Photo plus
properties like title, description, photographer, datestamp, etc.) to create
the default display settings for EVERY ZPhoto in the ZPhotoAlbum.
This should be available real-soon-now, as well as an example site
for which I am building this beast.

As such, folks that want RAW image processing capabilities, could use the
Photo product. Folks that want an online photo album could use ZPhotoAlbum
out of the box and browse away. Folks that want an online database for their
photos which link into a new system would have a little bit of work, but
that would be at the ZClass and DTML level.

I'll take the rest of these one at a time.

>
> My problem is that I'm not sure how to say "blah should be the object
referred
> to by my image property", and I'm also not sure how to set the class and
alt
> text in this usage (putting them after pdcookie didn't work).  I've tried
all
> sorts of weird stuff with _, getitem, dtml-with, dtml-let, but to no
avail.
>
This should work:
<dtml-var "blah(REQUEST, class='fooimage', alt='[Can't use dtml tags inside
dtml tags]', pdcookie='1')">
You can say exaclty the same thing using a syntax similar to image.
<dtml-var "blah.tag(REQUEST, class='fooimage', alt='[so use tricky python to
get the job done.]', pdcookie='1')">
The order of the extra tags does not matter, but the single quotes matter
alot.
I wish I could think of the python expression to grab your <dtml-var name>
and stuff it into your alt string, but I am suffering from sleep
deprivation.

Let me know right away if this doesn't work for you.

> Alternately, figuring out how to use this "pdcookie" feature from a normal
> <img> tag would work too.
>
Actually, you don't need the pdcookie feature at all. The photo object
ALWAYS checks for the presence of its cookie, if it finds it, it will render
to the preferred size, unless overridden by dtml.

> (I also tried deriving my class from Image or Photo and adding my extra
Info
> properties, but that was even harder to figure out.  At least this way it
> sort-of works.)
>
Yes. I imagine it would be. That seems to be the rub of object-oriented
programming, trying to build software that mimics that objects that we
experience in real life. I doubt I would figure it out either.
>
>
> Fixing the default Image Formats:
> To enable other formats, open the __init__.py that you put in PIL's
directory,
> and add the desired Image plugins onto the import list.  Mine looks like
so,
> now:
>
> import Image, ImageFile, ImageDraw,  _imaging, GifImagePlugin,
> JpegImagePlugin, PngImagePlugin
>
This seems correct to me. Thanks for your suggestion. I have had other input
on this as well. I think that leaving the file blank will also have the
desired
result. Curiously,  the blank __init__.py is installed in my Zope
installations,
but I have something different in the Photo product, so lets call it a bug.
In the
near future, I plan to package PIL seperately or package PIL INSIDE of
Photo, to avoid the issues with PIL installation.

Actually, I don't know which packaging scheme is better, package PIL with
Photo or package PIL outside Photo. I know of several products tthat require
 this. Photo, Poll, Dataminer, and a couple that I can't remember the name
of...

> Suggestion:
> As far as the Photo Product itself is concerned, I think that the default
size
> for thumbnails is way too huge.  128x128 seems more alike a preview size
than
> a thumbnail (I would put the latter at more like 32x32 or 64x64).  I know
I
> can fix it (says so right in the docs), but I thought I might put in my 2
> cents on that ;-)
>
Sure, but I need a 128x128 size.

Actually, I have had many people request to set their default WITHOUT
editing the source. This problem seems similiar to changing the default
skeleton in the DTML methods and documents. In other words, it should
be possible using the Zope debugger -- yet I don't even have a clue on
how to get started with that.

I look forward to your input.

Drew