Setting max size of cropped image

27 views
Skip to first unread message

Gharib

unread,
May 1, 2009, 4:52:25 PM5/1/09
to javascript-image-cropper-ui
Sometimes users upload large images and after cropping, the cropped
image (file) size is still large. Is there
a way to use the scaling part of the cropper to set a max file size of
the cropped image??

Dave Spurr

unread,
May 1, 2009, 5:02:15 PM5/1/09
to javascript-im...@googlegroups.com
You can't set a max file size, but you can set maximum physical dimensions.

-D

Adel_...@ao.uscourts.gov

unread,
May 1, 2009, 5:08:22 PM5/1/09
to javascript-im...@googlegroups.com

Thanks for the reply.

How about resolution; can we change the resolutuion of the cropped image

Adel

Tony Hadfield

unread,
May 1, 2009, 5:10:04 PM5/1/09
to javascript-im...@googlegroups.com
I am using asp.net, but when someone clicks crop, you can do all your image processing at that point.  Look around for script/code that can resize or change resolution.  I don't think this is something the cropper should be doing.

Dave Spurr

unread,
May 1, 2009, 5:12:11 PM5/1/09
to javascript-im...@googlegroups.com
Not in JavaScript, the image cropper UI is just the JavaScript UI part, the process you could do is:

1) User uploads image
2) Check size
    2a) If too big, resize
3) Display cropper
4) Crop image based on user settings

That stops you from displaying a huge image to the user in the first place.

If you want the original fidelity, but at the cropped size (or within a target size) you could do (1 to 3 as above):

4) Translate provided crop co-ordinates to the original uploaded image size
    4a) Crop image using translated co-ords
    4b) If still too big, resize

The second scenario would result in better image quality where the original image is a lot larger than the one presented to the user for cropping.

Hope that helps,

-D
Reply all
Reply to author
Forward
0 new messages