Cropping an image with Jcrop
Image editing and manipulation can sometimes be a difficult thing to implement in our application. Using Laravel and the Jcrop JavaScript library, we can make the task much simpler.
Tip
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Getting ready
We need to download the Jcrop library from http://deepliquid.com/content/Jcrop_Download.html and unzip it. Put the file jquery.Jcrop.min.js
into our public/js
directory, and the jquery.Jcrop.min.css
and Jcrop.gif
files into our public/css
directory. We'll use the Google CDN version of jQuery. We also need to make sure we have the GD library installed on our server, so we can do image manipulation. In our public
directory, we'll need an images folder to store the images, and should...