Hi Jan,
it seems that your issue is that you are trying to call PIL's
image object's method "Rotate" on Archetypes ImageField instance which
can't work for sure .. but you should have a look at your current
ATContentTypes package where these operations are already implemented
somewhere in the module: Products.ATContentTypes/Products/
ATContentTypes/lib/imagetransform.py
Btw: These operations would be accessable easily if you include
ATContentTypes.content.image.Image class as one of your's class parent
or you can use these transforms directly maybe .. but all that depends
on what is your goal.
Kind Regards
Lukas
On Aug 11, 2009, at 11:12 PM, Jan Pokorný wrote:
Hello,
I have a custum content type "SightFolder" with a field "img" of
"image" type. I would like to use some PIL transformations on the
image saved in the image field, so I have added a method into the
content type class. But all my attempts fail.
I import PIL as:
from PIL import Image
A field is defined as:
ImageField(
name='img',
widget=ImageField._properties['widget'](
label="Map",
),
searchable=0,
required=0,
storage=AnnotationStorage(),
),
A method in the class is defined as:
security.declarePublic('Rotate')
def Rotate(self, img):
out = img.rotate(45)
return out
And I try to call it from a template as:
<span tal:replace="structure
python:context.Rotate(context.img).tag()"></span>
But i generates the following error:
Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__
- __traceback_info__: context.Rotate(context.img).tag()
Module PythonExpr, line 1, in <expression>
Module Products.Sightseeing.SightFolder, line 142, in Rotate
AttributeError: rotate
Do you have any idea what is wrong? Is there any better way how to
input an image from a field into a method?
Thanks a lot for any help in advance.
Jan
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers