innostudio / fileuploader

Beautiful and powerful HTML file uploading tool. A jQuery, PHP and Node.js plugin that transforms the standard input into a revolutionary and fancy field on your page.
141 stars 25 forks source link

Check image width and height before upload #29

Closed bee-interactive closed 5 years ago

bee-interactive commented 5 years ago

Hi!

Because of the lack of capacity of the server in some cases if the user upload an image too large (in pixel size and not in weight), is it possible to restrict the images before uploading them? For example, you can not upload images that are larger than 2000x2000 pixels.

Because if the uploaded file is too big, the server will use too much memory later when handling images (generation of automated thumbnails).

Thanks!

innostudio commented 5 years ago

Hello.

you have to use the thumbnails.onImageLoaded option

if (item.reader.width > 2000 || item.reader.height > 2000) {
    item.remove();
}