简体   繁体   中英

How to crop an image using jquery ajax and php?

Hi I am doing an social networking project ,where i have an option to add/edit photos ,When user clicks the button the image will be uploaded to the database and it will be updated...but then when user click on the crop button it will open in some popup or modal window and then user crop that image then it will save in database through ajax and php and then display it on his position.

Is there any jquery plugin like this or need to do custom code.

if custom code then what is the best way.

This is the perfect script i found. for this

UberUploadCropper V2 – Upload, Crop, No Flash

A wonderful tutorial about crop photo using php and jquery , I made it for 5 months, and it has been used by a lot off applications. http://www.bewebdeveloper.com/tutorial-about-crop-photo-using-php-and-jquery

Try my online Photoshop tool built in PHP GD and Javascript.

http://www.sajithmr.me/photoshop/

Here you can crop, re-size, rotate add watermark image and add watermark text

I also published the full source code in my blog

Hope it helps

Thanks

Sajith

You could always use the 'jCrop' plugin (just Google jCrop) and use imagik to handle the resize and crop.

jCrop just basically gathers an x and y coordinate and targets the value into a hidden field in a form. So once you post the form you can just use the imagik method cropImage to crop the image using the post values like:

'cropImage($width, $height, $x, $y)'

Sorry the reply is a bit vague.

你可以尝试这个插件http://odyniec.net/projects/imgareaselect/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM