Using The Standard Facility
The metadata extraction facility only works with content items that
contain a link
field referencing a binary object.
That is, the content type definition in the
content-type
resource must contain a
field
in which the type
attribute
is set to link
. In addition, the default facility
currently only provides support for JPEG image files: other image file
formats and other media objects such as audio and video files are not
currently supported.
The metadata extraction facility does not support legacy image and media content types.
To make use of the default extraction facility, you must:
-
Add the following line to configuration-root
/com/escenic/storage/metadata/MetadataInjectionTransactionFilter.properties
in one of your configuration layers:serviceEnabled=true
You might need to create the file and directories.
-
Add a field called
COM.ESCENIC.DEFAULTMETADATA
to the content type definition in thecontent-type
resource. The new field must be a complex array composed of two sub fields calledKEY
andVALUE
. BothKEY
andVALUE
must bebasic
fields.The following example shows a content type definition for image files to which a default
metadata
field has been added (highlighted in bold).<content-type name="image"> <ui:label>Picture</ui:label> <ui:description>An image</ui:description> <ui:title-field>name</ui:title-field> <panel name="default"> <ui:label>Image content</ui:label> <field mime-type="text/plain" type="basic" name="name"> <ui:label>Name</ui:label> <ui:description>The name of the image</ui:description> <constraints> <required>true</required> </constraints> </field> <field mime-type="text/plain" type="basic" name="description"> <ui:label>Description</ui:label> </field> <field mime-type="text/plain" type="basic" name="alttext"> <ui:label>Alternative text</ui:label> </field> <field name="binary" type="link"> <relation>com.escenic.edit-media</relation> <constraints> <mime-type>image/jpeg</mime-type> <mime-type>image/png</mime-type> </constraints> </field> <field name="COM.ESCENIC.DEFAULTMETADATA" type="complex"> <array default="0"/> <complex> <field name="KEY" type="basic" mime-type="text/plain"/> <field name="VALUE" type="basic" mime-type="text/plain"/> </complex> </field> </panel> <summary> <ui:label>Content Summary</ui:label> <field name="caption" type="basic" mime-type="text/plain"/> <field name="alttext" type="basic" mime-type="text/plain"/> </summary> </content-type>
Whenever a content item is created based on such a content type
definition, and the binary content referenced is a JPEG file, then any
EXIF or IPTC metadata found in the file is automatically extracted and
injected into the COM.ESCENIC.DEFAULTMETADATA
field.
An array element is created for each metadata item: the name of the item
is injected into the KEY
subfield and the content of
the item is injected into the VALUE
subfield.
If you want better control over this process (if, for example, you want to select what metadata items are injected and to inject them into specific fields), then you will need to create your own plug-in. For a description of how to this, see The Plug-in API.