How to restrict the image DAM upload based on aspect ratio of uploaded image? | Community
Skip to main content
sureshy2015
Level 4
December 21, 2015
Solved

How to restrict the image DAM upload based on aspect ratio of uploaded image?

  • December 21, 2015
  • 1 reply
  • 1201 views

Hi,

We have a requirement of restricting the image upload based on aspect ratio.For example 3:2,16:9 should be allowed to upload and others need to be restricted.Is there any in built functionality to achieve the same or if any custom implementation required?.please help me for the same.

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 kautuk_sahni

Hi 

You can achieve this by writing a custom component there you can create a logic to restrict image with aspect ratio.

Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

//Community article to create a custom uploading component 

 

Option 2

You can also create a component that can auto crop you any image

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__lxlb-_this_contenthas.html

 

Option 3

Creation of custom aspect ratio component

Link:- http://experience-aem.blogspot.in/2013/09/cq-image-custom-aspect-ratios-crop.html

 

Option  4

Set fixed aspect ratio for all images

//

The cropConfig node structure is what youre interested in. text="16x:10" is what will appear in the Crop dropdown, value="16,10" is the actual fixed Crop size for the tool. You can add as many predefined crops you want per html5smartimage widget.

The image-16x10 and aspectRatio-16x10 names aren't required, but not a useful convention to help in maintainability of the config.If you allow multiple aspectRatios then the image-16x10 naming probably doesnt make as much sense tho its not a bad idea to provide semantic naming to your aspectRatio definition node.

Link:- http://stackoverflow.com/questions/15120888/is-there-aspect-ratio-cropping-in-cq5-not-just-free-crop (answer 2)

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

1 reply

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
December 21, 2015

Hi 

You can achieve this by writing a custom component there you can create a logic to restrict image with aspect ratio.

Link:- https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

//Community article to create a custom uploading component 

 

Option 2

You can also create a component that can auto crop you any image

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__lxlb-_this_contenthas.html

 

Option 3

Creation of custom aspect ratio component

Link:- http://experience-aem.blogspot.in/2013/09/cq-image-custom-aspect-ratios-crop.html

 

Option  4

Set fixed aspect ratio for all images

//

The cropConfig node structure is what youre interested in. text="16x:10" is what will appear in the Crop dropdown, value="16,10" is the actual fixed Crop size for the tool. You can add as many predefined crops you want per html5smartimage widget.

The image-16x10 and aspectRatio-16x10 names aren't required, but not a useful convention to help in maintainability of the config.If you allow multiple aspectRatios then the image-16x10 naming probably doesnt make as much sense tho its not a bad idea to provide semantic naming to your aspectRatio definition node.

Link:- http://stackoverflow.com/questions/15120888/is-there-aspect-ratio-cropping-in-cq5-not-just-free-crop (answer 2)

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni