[Zope] Help on mass import of images

Sven Rudolph rudolph@medical-tribune.de
Thu, 6 Dec 2001 18:19:07 +0100


Hello Seb,

> yes, the data has to be in a string format, but you are passing in the
> string "TheImage", AFAICT.
No, no. I used the string "TheImage" only as a placeholder for the postin=
g, because a base64 encoded image is _very_ long. Of course I used the co=
rrect string representation of the image in my method. You can see it in =
the file "import_pictures_base64_asstring.py" I sent you to your private =
mail adress.

The code looks like this:
>>>>>>>>>>>>>
from OFS.Image import Image

def import_pictures(self):
 id=3D'testbild'
 handle=3DImage(id,'','',content_type=3D'image/gif')
 self._setObject(id,handle)
 self._getOb(id).update_data('R0lGODlhDwK6...<verylongbase64stringofmyima=
ge>...VdzuWAAAA7',content_type=3D'image/gif')
<<<<<<<<<<<

But this didn't work. The image object was created, but the image data wa=
s broken. When I tried to send the binary data of the image as string I g=
ot something like this:
 self._getOb(id).update_data('GIF89a^0^0.....<verylongbinarystringofmyima=
ge>....^=C4^@^@',content_type=3D'image/gif')
This resulted in a "syntax error" from the interpreter...
:-(


I thought about using FTP too. But actually I want to use my own image cl=
ass. And I don't know how to tell Zope to use my image class rather than =
the built in image class when accepting images through FTP.

> hookable put: (I searched for 'hookable put' on the zope.org search -
> follow the resources link at the top of the page for more ideas about
> where to search the mailing lists from)
> http://www.zope.org//Members/michel/Projects/Interfaces/NewObjectPutHan=
dler
I will look at this page...

Thank you very much for your answer!

Sven

--=20
Sven Rudolph
GermanMedicalServices.de GmbH
Unter den Eichen 5, 65195 Wiesbaden
Tel.: 06 11 / 97 46 25 2