Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-70228

As a developer I would like to know the real width and height of the images

    Details

      Description

      Motive

      We are not storing the width and height values of the image anywhere in the portal. In order to obtain the width and height of an image, we need to read the entire file and obtain the values, and that's an expensive operation that shouldn't be executed everytime we need to obtain the height and width of an image.

      Based on the Adaptive Media Image configuration we can have a rough estimation about the width and height, but we don't know the exact values of the width and height of the image. Adaptive Media scales the image based on the max-width and max-height values specified in the configuration. During the scalation process, it keeps the aspect-ratio, so only one of the values (width or height) will match the maximum values specified in the configuration. If the image is small, it might not even match one of those.

      The aim of this story is to store the dimensions of an image in the database, so every time a new image is uploaded and their adaptive media variants are generated, we calculate their dimensions only once and store it in the database.

      By doing this, we can easily obtain the dimensions of any image by querying the database and avoiding expensive calls.

      Besides the dimensions, the size is another important attribute that should be available as well.

      Acceptance Criteria

      • From an adaptive media image object, developers can easily obtain the width, height and size without a performance impact.
      • The image width, height and size should be returned in the REST api as well.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sharon.choi Sharon Choi (Inactive)
              Reporter:
              sergio.gonzalez Sergio Gonzalez (Inactive)
              Recent user:
              Kiyoshi Lee
              Participants of an Issue:
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Packages

                  Version Package
                  7.0.0 M6