Compress pictures before upload using the upload widget

1 Answer 49 Views
Upload
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Morten asked on 08 Sep 2024, 07:17 PM

I use the upload widget in a long-running web app to allow picture upload.

Over the years, the number and size of pictures have increased.

I compress property in the upload widget would be great, however, short of this, has anyone played around with compressing images in the browser in connection with using the upload widget?

/Morten

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 11 Sep 2024, 11:51 AM

Hi, Morten,

It is usually better to let developers perform any file modification operations as there is no way to tell what the expected result may be or what downsides such operations may have in certain cases. Performing them internally could lead to problems.

You can access the rawFile in the select event of the component. Afterwards you can apply different techniques to try and reduce its size.

I am not very familiar with image optimization, however here are some resources that I managed to find:

https://stackoverflow.com/questions/46907374/resize-compress-uploaded-image-in-javascript 

https://stackoverflow.com/questions/14672746/how-to-compress-an-image-via-javascript-in-the-browser 

https://stackoverflow.com/questions/43038250/how-to-compress-image-size-in-javascript 

Best Regards,
Georgi Denchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Upload
Asked by
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Georgi Denchev
Telerik team
Share this question
or