July 29, 2013 7:04 am

How to Crop Image with jQuery and PHP

I have received many requests from my readers to write something on image crop in php, so today I am going to write this tutorial on PHPGang how to crop images with jQuery and PHP. I have used jCrop javascript library to perform this task with PHP its a very easy to implement and very useful for thumbnail generation. Hope you love this tutorial.

crop-images

 

PHP Methods to save image:

 

This will simply show image on crop if you want to save that image in some directory then make changes in last two line as below.

 

Javascript Configurations:

 

 

Author Huzoor Bux

I am Huzoor Bux from Karachi (Pakistan). I have been working as a PHP Developer from last 5+ years, and its my passion to learn new things and implement them as a practice. Basically I am a PHP developer but now days exploring more in HTML5, CSS and jQuery libraries.


Tutorial Categories:
  • This is an awesome tutorial . It is very useful for me. šŸ™‚

  • selvakumar

    How to crop image in round shape. But It shuld not include the css. I want new image in round shape. Tell me sir

  • vivek

    Hello there i am unable to download the source code event after signin

  • Jignesh

    Hi i am not able to download source code even after subscribe

  • Kevin

    hi, i can’t download source code

  • Joshua

    I receive this error when I try to save to directory /uploads… Warning: imagejpeg() [function.imagejpeg]: Unable to open ‘/uploads’ for writing: Permission denied in

    I am trying to save the image after crop using this line of code:

    imagejpeg($dst_r,’/uploads’,$jpeg_quality);

    Please help!

    Thanks!

    • huzoorbux

      The problem is that your folder is not having write permission. And because of that it is not uploading the file.

      You have to give it write permission. You can also use chmod for giving write permission to that folder.

    • Banu

      same error occurs to me if you got the answer pls reply to my mail id. id: rdbanu7@gmail.com.
      thank you

  • Chamandeep singh ranot

    very nice…….its very helpfull…