A very usefull function in js for downsizing images client side. You can accept big images without fear, this will downsize them before you send them to your server.
The interesting bit of code is in dowsize-image.js, the rest is just for testing. It was tested with 35MB images on chrome, firefox and edge desktop. It was also tested with chrome, firefox and safari on mobile.