function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Avinash KaltariAvinash Kaltari 

Validating Image Dimensions (width and height) of an image saved as an attachment

Hello, I need to validate the image dimensions, i.e. its width and height. Is there any way in which i can do this after saving the image as an Attachment record through JavaScript or through VF. Please suggest some alternative ways to do this if you know. Any help would be appreciated. Thanks, Avinash Kaltari.
Pradeep_NavatarPradeep_Navatar

Tyrout the syntax given below :

 

               document.getElementById("img1").style.width=500;

               document.getElementById("img1").style.height=500;

 

Hope this helps.

Avinash KaltariAvinash Kaltari
Hello, This is my scenario in detail : 1. I have a VF Page with a apex:inputFile tag (through which the user would be able to browse and select for an image) 2. I will get the image saved once the user hits "Save" button. 3. I need to check the dimensions of this image (saved as an attachment) and display the appropraite error message through either JavaScript or the Apex Code. 4. So, coming back to my question, Is there any way in which i can check the dimensions of this image (saved as an attachment) either in Javascript or Apex code ?? Anyways, Thanks for the reply Pradeep.