scottcheng / cropit

A "customizable crop and zoom" jQuery plugin.
http://scottcheng.github.io/cropit/
MIT License
874 stars 305 forks source link

how to get both the original and cropped imges #182

Open shibin-pb opened 8 years ago

shibin-pb commented 8 years ago

Hi,

Thanks a lot for this project.

How do i get both the original and cropped images

it's posible?

Thanks again

fsanchezro commented 8 years ago

I also wonder ... Is it possible ?

MacGyer commented 8 years ago

As there is an (hidden) file input, you can embed the cropit in a regular form with enctype="multipart/form-data" and send the form to a PHP script. This script can access the original file via the $_FILES variable and you can do further server side stuff with the image.

tisuchi commented 8 years ago

@MacGyer

Think of that, I have to save my original file and cropped file in separate folder with same name. My image name has generated with hash of micro second.

What do you suggest then?

MacGyer commented 8 years ago

@tisuchi Well that's really easy. You get the cropped image as Data URI, read the data and save it as a regular file in the folder you want to.

The original image is transferred to the server in $_FILES. You can simply use move_uploaded_file($src, $dest) to save the file in the other folder.

See: Data URI to file move_uploaded_file