Derived Representations

Sometimes you want Content Store users to be able to create a set of representations that have identical contents (that is, use the same crop mask), but have different output sizes for use in different contexts. You can do this by defining derived representations. A derived representation is a representation that is based on another representation. It gets its crop mask from the representation it is based on, but can have a different output size.

The crop mask example shown in the previous section can be simplified by replacing the wide representation with a derived presentation as follows:

    <panel name="crop-masks">
      <ui:label>Cropped Versions</ui:label>
      <field mime-type="application/json" type="basic" name="representations">
        <ui:label>Image Versions</ui:label>
        <rep:representations type="image-versions">
          <rep:representation name="thumbnail">
            <rep:output width="100" height="100"/>
            <rep:crop/>
            <rep:resize/>
          </rep:representation>
          <rep:representation name="narrow">
            <rep:output width="500" height="400"/>
            <rep:crop/>
            <rep:resize/>
          </rep:representation>
          <rep:representation name="wide" based-on="narrow">
            <rep:output width="1000"/>
          </rep:representation>
        </rep:representations>
      </field>
     </panel>

With this set-up, CUE users will no longer need to (or be able to) define a crop mask for the wide representation. This representation will always have exactly the same contents as the narrow representation: it will just be output at twice the width and height.