Hi! Is there a function in python like ImageFile() for a normal file, like a pdf? If so, can you tell me where I have to import it from. Thanks Sebastian
Sebastian Queißer wrote:
Is there a function in python like ImageFile() for a normal file, like a pdf? If so, can you tell me where I have to import it from.
I think you need to do something like: import OFS f = open('path/to/file', 'rb') data = f.read() f.close() self._setObject(fileID, OFS.Image.Image(fileID,'Laerings graf','')) self._getOb(fileID).update_data(data)
Sebastian Queißer wrote at 2003-3-24 18:54 +0100:
Is there a function in python like ImageFile() for a normal file, like a pdf?
You can use "ImageFile" here, too. The only difference (between "Image" and "File") is the "__str__" method: for an image, it results in an "img" tag, for a file it's the files content. You loose the option to access the content with "str(...)" for "ImageFile", but you probably do not need it.... Dieter
participants (3)
-
Dieter Maurer -
Max M -
Sebastian Queißer