[Zope] How to convert an Image to an Photo programmatically ?
Joachim Schmitz
js@aixtraware.de
Thu, 21 Mar 2002 17:33:28 +0100
thanks, that did the trick for images under 64kb, the following works for=20
all images:
try:
photo._data =3D file.read()
except AttributeError:
if type(file) is type(''):
photo._data =3D file
else:
photo._data =3D file.data
file=3Dfile.next
while file is not None:
photo._data +=3D file.data
file=3Dfile.next
--On Donnerstag, M=E4rz 21, 2002 10:09:00 -0500 Ron Bickers=20
<rbickers-dated-1017328138.23aa81@logicetc.com> wrote:
>> -----Original Message-----
>> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
>> Joachim Schmitz
>
>> I have a bunch of images in the ZODB, which I want to convert to
>> Photos in
>> the Photo product.
>
>> Error Type: AttributeError
>> Error Value: read
>
> There is a problem with Photo 1.2.3 that breaks what you're doing. Apply
> the following changes to fix it:
>
> In Photo.py, manage_addPhoto(), replace the following line:
>
> photo._data =3D file.read()
>
> with this:
>
> try:
> photo._data =3D file.read()
> except AttributeError:
> photo._data =3D file
>
> _______________________
>
> Ron Bickers
> Logic Etc, Inc.
>
Mit freundlichen Gr=FC=DFen Joachim Schmitz
--------------------------------------------------------------------
AixtraWare Ingenieurb=FCro f=FCr Internetanwendungen
H=FCsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163
--------------------------------------------------------------------
Key fingerprint =3D DA10 CC82 62F8 1DBB 39A1 1EDC 725B 3317 A8D7 C3A6
Keyserver: http://germany.keyserver.net/en/