Thanks for the help everyone.
I have implemented the transformer to do the watermarking, thanks to
Joshua's excellent example:
public class WatermarkImageTransformer implements
ImageContentTransformer {
public Image transform(Image image, Map<String, String> attr)
throws ContentManagerException {
... code for doing the watermark...
}
}
I have modified my bean accordingly (relevant bits only):
public class HistoricSitesPhotoData extends MetaData {
...
private static final WatermarkImageTransformer WATERMARKER = new
WatermarkImageTransformer();
public void activateMetaData() {
... other constraints...
addConstraint(new ConstrainedProperty("image")
.notNull(true)
.file(true)
.listed(false)
.mimeType(MimeType.IMAGE_JPEG)
.contentAttribute("watermark", this.getPhotographer())
.transformer(WATERMARKER));
...
}
Now I already have a CMF table "historicsitesphotodata" created and
populated before I added the above constraint. If I've understood
Content Transformers correctly, I think that my RIFE/CRUD app which adds
images to the database would apply the above transformer to do a
watermark prior to storing the image? I don't see this happening, in
fact my transformer is never called when I add an image to the database
this way. I am thinking I have to reinstall all my CMF tables and
reenter all the data in order that CMF will recognise the transformer? I
assume the above constraint maps onto something in the Postgres world
which invokes the transformation.
Is it possible to register the transformer with the "serve_content"
element e.g.
<element id="serve_content" file="rife/cmf/serve_content.xml"
url="/content/*">
<property name="datasource"><datasource><config
param="DATASOURCE"/></datasource></property>
<property name="transformer">... some reference somehow to the
transformer class ...
</property>
</element>
so that the watermarking gets done when the image is output?
Thanks for any further help.
David Herbert
British Antarctic Survey
--
This message (and any attachments) is for the recipient only. NERC is subject
to the Freedom of Information Act 2000 and the contents of this email and any
reply you make may be disclosed by NERC unless it is exempt from release under
the Act. Any material supplied to NERC may be stored in an electronic
records management system.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"rife-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---