Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-21311

Default Picture Conversions cannot be disabled

    XMLWordPrintable

    Details

    • Upgrade notes:
      Hide

      No more 'default' attribute on 9.1+, a picture conversion can be disabled with the `enabled` attribute.

      On 8.10 and 7.10, the `default` attribute still exist. To disable a default picture conversion, `enabled` AND `default` need to be set to `false`.

      Show
      No more 'default' attribute on 9.1+, a picture conversion can be disabled with the `enabled` attribute. On 8.10 and 7.10, the `default` attribute still exist. To disable a default picture conversion, `enabled` AND `default` need to be set to `false`.
    • Sprint:
      nxfit 9.1.3
    • Story Points:
      1

      Description

      Starting with 8.10? there are 5 default picture conversions; Thumbnail, Small, Medium, FullHD and OriginalJpeg.
      For huge load test and performance reason, there is a need to keep only Small and FullHD (for Thumbnail and display in the UI mainly).

      Unfortunately, the default attribute of the configuration cannot be overriden, the source code forbids that (cf below).

      The documentation is explicit: The contributions whose default attribute is set to true cannot be disabled nor filtered. So the idea is to override the default picture conversion we want to disable, changing their default attribute to false and adding an enabled attribute set to false:

      1. Here is the default Thumbnail conversion (see imaging-service-contrib.xml in nuxeo-platform-imaging-core):

      <extension target="org.nuxeo.ecm.platform.picture.ImagingComponent" point="pictureConversions">
        <pictureConversion id="Thumbnail" description="Thumbnail size"
              maxSize="100" order="0" chainId="Image.Blob.Resize"
              default="true" rendition="true" />
        . . . other conversions . . .
      </extension>
      

      2. Here is my Studio XML contribution:

      <extension target="org.nuxeo.ecm.platform.picture.ImagingComponent"
          point="pictureConversions">
          <pictureConversion id="Thumbnail" description="Thumbnail size"
            maxSize="100" order="0" chainId="Image.Blob.Resize"
            rendition="true"  default="false" enabled="false" />
      </extension>
      

      So basically, I explicitely set default as false and disable the contribution

      3. Once deployed, it does not work and a warning is logged:

      [org.nuxeo.ecm.platform.picture.PictureConversionRegistry] The picture conversion 'Thumbnail' is marked as default, enabling it.
      
      

      4. Looking at the code of PictureConversionRegistry.merge and running it via the debugger, we have:

      • The source parameter is the new contribution (default="false" enabled="false")
      • The dest parameter is the default one and the merge is done by merging source inside dest

      Hence, logically, the test if (!dest.isEnabled() && dest.isDefault()) returns true and the dest contribution is reset to enabled = true

      So, ultimatelly, if it is possible to...

      • Add new default conversions
      • Modify exising once (change the chain used for example)

      ... it is is impossible to remove some conversions.

      Notice I understand that the UI also assumes some conversions exist ("Small" for Thumbnails and "FullHD" for display). In my case, for performance reasons when importaing new images, I want to keep only Small and FullHD

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: