Leonardo Rochael wrote:
Hi Héctor


Héctor Velarde wrote:
...

I was wondering if there is a way to modify the marshaling of ATImage content type in order to allow it to read the IPTC record embedded in the image to create automatically the image with title and description mapping the headline and caption fields.

we have been using a Python library called IPTCInfo to read and write information inside JPG images successfully.


I would suggest you create a new product with a new ATImage subclass,
wherein you override the setImage() mutator to call the original one and
then use IPTCInfo to also set the other attributes. Then you need to change
the mimetypes registry to point to your type instead of ATImage.

Alternatively, you could either monkeypatch the ATImage .setImage() (which
is ugly but works when in a hurry) or listen to ObjectModifiedEvents for
ATImages and set the other attributes with the IPTC information.

the third of these choices seems preferable, IMO. it would also be possible to define a new marker interface (IIPTCImage, possibly) and declare this to be implemented by the ATImage class via ZCML. you could define adapters, listen to events, and declare new views based on the marker interfaces. and you could re-use the same marker interface for news items, or anything else that may have an ImageField, w/o needing to subclass from ATImage.

-r


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to