Closed SpaceK33z closed 9 years ago
Thanks for the PR, but why would you need to limit the file size of the original image? It would only be processed on the client side. In the majority of cases you would only need the cropped image, which would be resampled anyway. Moreover, one of the purposes of an image cropper is so that the user doesn't have to worry about preprocessing (resizing, cropping) the image before uploading it, and it seems to me limiting the file size defeats that purpose to some extent.
That is true, but I fear it could crash people's computers when dealing with very large images. Even on my MBPr with 16gb of ram and i7 opening the devtools was extremely slow.
You are right that it could happen on some machines/browsers that loading an extremely huge image would crash, but I don't think that makes a reason to limit file size for all users.
Regarding your case, I suppose the reason it gets laggy when you open devtools is because the image data (in base64) is inserted into the DOM as image source. It should work fine for "regular" users who don't browse with devtools open.
Okay, looks like I didn't think this through ;p. I will test next week on some old computers if uploading a large image (> 7mb) has a huge performance impact.
I've added a
maxFileSize
option that lets you specify the max file size in bytes.