Uploaded image for project: 'Magnolia DAM Module'
  1. Magnolia DAM Module
  2. MGNLDAM-720

Provide an easy way to get image width, height and meta data

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Workaround exists
    • Icon: Neutral Neutral
    • None
    • 2.2.5
    • DAM Templating
    • None
    • Yes
    • Yes

      Due to request from support, after checking with our KB, we didn't have an explicit support for this on either documentation or codebase:

      From earlier Magnolia versions I know a way via model class...

      PropertyUtil.getLong(AssetNodeTypes.AssetResource.getResourceNodeFromAsset(node), AssetNodeTypes.AssetResource.WIDTH, 0l);

      But this is slightly complicated. You need your own model class and so on... Is there simple way to retrieve the image width/height directly inside FTL template?

      Workaround
      Using damfn you can get the Asset object which has a getMetadata() method. The MagnoliaAssetMetadata has both getWidth() and getHeight() methods.

        Acceptance criteria

              Unassigned Unassigned
              viet.nguyen Viet Nguyen
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD