Retrieve Image Extension | Community
Skip to main content
Level 5
September 10, 2020
Solved

Retrieve Image Extension

  • September 10, 2020
  • 1 reply
  • 819 views

Hello Community - We have an image component, in that authors will be selecting images. without having any separate field selection of the image type/extension in the dialog, I wanted to retrieve the selected image extension and based on that, we will perform some logic. is there a way to retrieve the image extension of the selected image in HTL.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ravi_Pampana

Hi,

 

Check below code to get the image extension from image resource

 

Image image = new Image(resource); // resource - image resource

image.getExtension();

 

For more details, please refer

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/ImageResource.html#getExtension()

Hope this helps!

1 reply

Ravi_Pampana
Community Advisor
Ravi_PampanaCommunity AdvisorAccepted solution
Community Advisor
September 10, 2020

Hi,

 

Check below code to get the image extension from image resource

 

Image image = new Image(resource); // resource - image resource

image.getExtension();

 

For more details, please refer

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/ImageResource.html#getExtension()

Hope this helps!