We want to write a handler to throw error back to the user while uploading an image if it does not conform to standard height and width. What's the best and recommended way to do this?
How to read asset being uploaded and extract it's size before allowing it to be uploaded?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi
Please have a look at this forum post discussing similar use case.
// How to decline image upload when the size of the image is more than the expected?
Write a custom Sling Servlet that uploads DAM Assets. In the Sling Servlet - use the Asset Manager API. You have full control and if the asset is larger than you want, you can prevent it from going into the DAM. See this article on how to use Asset Manager API:
https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html
Read all the comments.
// Restrict file uploads by size & type in DAM upload dialog
I hope this will help you.
~kautuk
Views
Replies
Total Likes
Hi
Please have a look at this forum post discussing similar use case.
// How to decline image upload when the size of the image is more than the expected?
Write a custom Sling Servlet that uploads DAM Assets. In the Sling Servlet - use the Asset Manager API. You have full control and if the asset is larger than you want, you can prevent it from going into the DAM. See this article on how to use Asset Manager API:
https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html
Read all the comments.
// Restrict file uploads by size & type in DAM upload dialog
I hope this will help you.
~kautuk
Views
Replies
Total Likes
As Kautuk suggest - you need to perform this operation in a Sling Servlet. See the article that Kautuk points to as it shows you the syntax you need to handle files via a Sling Servlet. You would use Java logic to test the image and if it fails - do not process the file. If it passes - use the AssetManager API to process the file.
Views
Replies
Total Likes
Views
Likes
Replies