[Zope] PIL: can't call same method twice
Chris
chris-zopemailing at gmx.de
Sat Mar 5 09:06:39 EST 2005
Hi David,
this is not the problem (tried it before).
The code
foo = container.resize(context.REQUEST.image, size=size) # works nicely
foo = container.resize(context.REQUEST.image, size=size) # 2nd time ->error
does what you suggest. But it raises the same error.
I looked at the request to see whether image is altered during the
resize (but why should it be altert at all?): before and after resize
the request has
image <ZPublisher.HTTPRequest.FileUpload instance at 0x9668e2c>
as expected.
It lookt more like a bug (?!?) in the PIL-code. So I looked into the
open method of PIL.Image.py (PIL 1.1.4) to no avail. With my limited
knowedge I could not see anything obvious. The open() method opens the
file "read-only" and tryes to identify the file by reading some header
information of the file instance. This is failing however. I guess the
prefix is not identified correctly. To do this, open() reads the first
16 characters ot the file. Since I don't know much about the header
informations of images (tryed jpg and gif) I can not tell whether they
are correct.
So I still have no clue :-(
Regards Chris
David Hassalevris wrote:
>
> Maybe move this line
>
> image=context.REQUEST.image # passed from a html-form
>
> inside your for loop. Maybe image is being changed iteratively.
> eg,
>
> for i in range(0,x):
> image=context.REQUEST.image # passed from a html-form
> foo = context.resize(image, size=size)
>
> Just a guess,
> David
> _______________________________________________
> 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 )
>
>
More information about the Zope
mailing list