This is a migrated thread and some comments may be shown as answers.

How to get Image width and height on upload image?

1 Answer 1818 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Adil
Top achievements
Rank 1
Iron
Veteran
Iron
Adil asked on 23 Jun 2020, 01:57 PM

Hi Telerik Family,

I have kendo upload and i'm uploading some image and video with  that . I need to check image width and height of image so than i can understand image is proper or not proper.

I checked you have "e.files[0].size" value for .Select() event but that is not useful for me.

 

What you suggest?

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 25 Jun 2020, 01:28 PM

Hello Adil,

You can create a new Image() object from the raw file, available in the event data in the Upload's Select event handler. Then you can access its naturalHeight and naturalWidth properties.

Details are available in online resources not specifically related to UI for ASP.NET MVC, since this is not a functionality that's built-in in our Upload:

https://stackoverflow.com/a/13572240/7009923

https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL

 

Regards,
Ivan Danchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Upload
Asked by
Adil
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Ivan Danchev
Telerik team
Share this question
or