[Zope] python/ retrieving JPG from folder

VIGNAUX Philippe philippe.vignaux at africamuseum.be
Wed Oct 20 06:16:37 EDT 2004


Thanks for your proposal of the "photo and photo folder" product.
I'll surely use it as I don't see any other possibility.

But the goal was to know the bloody way to get the content of a picture
and provide it as a parameter to a method.

I can't believe it's not possible within Python as I'm so close to the
solution !

for item in context.remote.fileValues():
    context.makethumbnail(??item??)

nb: item.id gives the name of the picture. I need to reach the content,
i mean the picture itself.


Ph.


-----Original Message-----
From: zope-bounces at zope.org [mailto:zope-bounces at zope.org] On Behalf Of
Garito
Sent: mercredi 20 octobre 2004 10:33
Cc: zope at zope.org
Subject: Re: [Zope] python/ retrieving JPG from folder

VIGNAUX Philippe wrote:

> Hi all !
>
> My zope config : Zope 2.6.4 (binary release, python2.1, win32-x86)
>
> I want to read the content of a folder (localfs) that contains
> pictures (JPG) to create thumbnails for these pictures.
>
> Nb : < remote > is the name of my zope local file system.
>
> for item in context.remote.fileValues():
>
> print item.id
>
> return printed
>
> gives as result :
>
> Chateau.jpg
>
> Paradise.jpg
>
> Which is right.
>
> for item in context.remote.fileValues():
>
> context.makethumbnail(item)
>
> gives the error message that you find below. (attribute error read)
>
> The < makethumbnail > external method has been tested and works FINE !
>
> If I give as parameter for this method the result of <input
> type="file" name= ...... >, a thumnail is well created.
>
> So the problem is : what's the right way to give the picture itself
> listed in the folder contents, as parameter in my python code ????
>
> Any help greatly appreciated !
>
> Regards,
>
> Philippe.
>
> *Exception Type*
>
>
>
> AttributeError
>
> *Exception Value*
>
>
>
> read
>
> Traceback (innermost last):
>
>     * Module ZPublisher.Publish, line 98, in publish
>     * Module ZPublisher.mapply, line 88, in mapply
>     * Module ZPublisher.Publish, line 39, in call_object
>     * Module Shared.DC.Scripts.Bindings, line 252, in __call__
>     * Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec
>     * Module Products.PythonScripts.PythonScript, line 314, in _exec
>     * Module Script (Python), line 3, in test
>       *<PythonScript at /afrigeopict/test>*
>       *Line 3*
>     * Module Products.ExternalMethod.ExternalMethod, line 231, in
__call__
>       __traceback_info__: ((<LocalFile instance at 02D75CC8>,), {},
>       (100,))
>     * Module C:\PROGRA~1\zopedb01\Extensions\thumbnail.py, line 8, in
>       makethumbnail
>     * Module PIL.Image, line 1547, in open
>
> AttributeError: read
>
> ###########################################
>
> This message has been scanned by ICT - Africa Museum
>
>-----------------------------------------------------------------------
-
>
>_______________________________________________
>Zope maillist  -  Zope at zope.org
>http://mail.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>
Hi
I asking myself if you need a product that creates thumbnails
automatically
I use Photo and Photo Folder, try it, perhaps it solves your problem

Cheers

_______________________________________________
Zope maillist  -  Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )
###########################################

This message has been scanned by ICT - Africa Museum



More information about the Zope mailing list