Defining Media Content Types

Content types are not only used to define stories. A publication will usually also include content type definitions for a variety of media types: images, videos, audio tracks, documents such as Word files and PDFs and so on. A media content type must have at least two fields:

  • One link field (type=link)

  • One slug field

The link field in this case is used to hold a link to the media file. The link field must have:

  • A child relation element with the content com.escenic.edit-media

  • A child constraints element that limits the content of the relation to the appropriate MIME types. So for an image content type, this would typically be:

    <constraints>
      <mime-type>image/jpeg</mime-type>
      <mime-type>image/png</mime-type>
      <mime-type>image/gif</mime-type>
    </constraints>

    or for a video content type:

    <constraints>
      <mime-type>video/*</mime-type>
      <mime-type>application/x-troff-msvideo</mime-type>
      <mime-type>application/mxf</mime-type>
    </constraints>

    and so on.

As with story content types, media content types may also contain many other fields, grouped into different panels. An image content type, for example, usually contains a crop panel, with a field that can be used to set up alternative image versions called representations.