Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-1267

Helper to resize an image keeping the aspect ratio (as a fiel of structured content)

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 3.0
    • 3.0 M4
    • Plugin : Web
    • None

      It should be useful to have a XSL helper to resize an image, keeping the aspect ratio, to fit in a rectangle with specified maximum dimensions.

          [CMS-1267] Helper to resize an image keeping the aspect ratio (as a fiel of structured content)

          Done with 2 xsl functions :

          • to resolve and resize image with keeping ratio
            resolver:resolveBoundedImage(imageType, imagePath, maxWidth, maxHeight)
            
          • to resolve an image with specific width and height
            resolver:resolveImage(imageType, imagePath, width, height)
            

          with namespace xmlns:resolver="org.ametys.cms.transformation.xslt.ResolveURIComponent"

          Laurence Aumeunier added a comment - Done with 2 xsl functions : to resolve and resize image with keeping ratio resolver:resolveBoundedImage(imageType, imagePath, maxWidth, maxHeight) to resolve an image with specific width and height resolver:resolveImage(imageType, imagePath, width, height) with namespace xmlns:resolver="org.ametys.cms.transformation.xslt.ResolveURIComponent"

          yes but this is another debate on another ticket

          Raphaël Franchet added a comment - yes but this is another debate on another ticket

          Okay.
          What might be interesting too would be to be able to manage image rendering "profiles" in the back office : "thumbnail" (100x100 max), "full", and so on.
          Image would be called like http://.../plugins/explorer/view/thumbnail/imageid.ext
          This would make caching easier, too (one filesystem directory by profile).

          Nicolas Gavalda (Inactive) added a comment - Okay. What might be interesting too would be to be able to manage image rendering "profiles" in the back office : "thumbnail" (100x100 max), "full", and so on. Image would be called like http://.../plugins/explorer/view/thumbnail/imageid.ext This would make caching easier, too (one filesystem directory by profile).

          This will not be done the xslt way but directly through a pipeline

          For example :
          http://..../plugins/exporer/view?id=...&max-width=100&max-height=100

          Acceptable parameters could be :

          • max-width
          • max-height
          • min-width
          • min-height
          • width
          • height

          A cache of modified image have to be created to avoid performance issues.

          This system allow to always store images as they are, and to transform them at read time. (Can be using it as a thumbnail somewhere and as a normal sized image somewhere else.

          Raphaël Franchet added a comment - This will not be done the xslt way but directly through a pipeline For example : http://..../plugins/exporer/view?id=...&max-width=100&max-height=100 Acceptable parameters could be : max-width max-height min-width min-height width height A cache of modified image have to be created to avoid performance issues. This system allow to always store images as they are, and to transform them at read time. (Can be using it as a thumbnail somewhere and as a normal sized image somewhere else.

            cedric Cédric Damioli
            ngavalda Nicolas Gavalda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: