[Zope] showing images

Miruna Badescu m.bulandra@bucarest.finsiel.ro
Fri, 25 Oct 2002 12:16:52 -0700


Hi Ebbe,

b/ Once you have figured out a 'test' for the existence of the picture
file, you can write something like:

<dtml-in list_of_Pictures>
	<dtml-if test>
		<dtml-call "REQUEST.set('tempPict',
_['sequence-item'][0])">
	<dtml-else>
		<dtml-call "REQUEST.set('tempPict', dummyPicture)">
	</dtml-if>

	... here you show the metadata and tempPict ...
</dtml-in>

providing that 'list_of_Pictures' is the full list you must show and
sequence-item is the list containing the picture itself and metadata of
your picture.

a/ if the picture has a correspondent thumbnail in Zope, you can test by
size (if is >0 ) or by content_type (if it's not
'application/octet-stream').
My suggestion is to make Zope objects for all the images and to keep an
extra Boolean property of the Zope object like 'has_largerImage'.

If not, it depends on how you keep the picture in a database: the file
you probably keep in a blob. If the blob is on the same record with the
metadata (which is not recommended), you should have at list a field
like 'content_type' or 'size' that you can test.
If you have the blob in a separate table, it's fine, since you have a
filed saying what's the id of the record from the other table a, let's
say, 0 for nothing.

Tell me if that solves the problem=20

Cheers,
Miruna


|| -----Original Message-----
|| From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of
Ebbe
|| Kvist
|| Sent: Friday, October 25, 2002 3:17 AM
|| To: zope@zope.org
|| Subject: [Zope] showing images
||=20
|| Hi all,
||=20
|| I am starting to figure out things about Zope. And to this problem I
have
|| not yet figured out an answer:
|| I have a lot of metadata about photos stored in a MySQL database. I
have
|| developed a Zope interface to show the metadata per picture using
Zope
|| and it works fine. I store small thumbnails in Zope for some, but not
all
|| the pictures. The thumbnail files have the same id as the MySQL
variable
|| idnumber which I show on the screen together with other metadata.
|| My problem is that I cant figure out how to
||=20
|| a/ test if there is a thumbnail file for the idnumber variable and
|| b/ if so - show it together with the metadata - and if not - show a
dummy
|| picture instead
||=20
|| I have tried many things but it seems impossible to have Zope test if
the
|| contents of the <dtml-var idnumber>  variable can be used to check
the
|| exsitence of a possible thumbnail file with the same name.
||=20
|| Is there a solution?
||=20
|| Best regards from sunny but rather cold Stockholm,
|| Ebbe
||=20
||=20
|| _____________________________________________________________
|| H=E4r b=F6rjar internet!
|| Skaffa gratis e-mail och gratis internet p=E5 Spray =
http://www.spray.se
||=20