Crop / Compression Tool


Crop Tool is a app which aims to provide an easy way to crop and compress image with your desired width and height, maintaining its aspect ratio.


3 Step Easy Install (Top)


  • Step 1: Unzip folder and paste in your localhost or server.
  • Step 2: Open browser, then type the path where you pasted the app "http://your_app_path".
  • Step 3: Click Browse and select the image file to upload and click on submit.

Usage (Top)


  • Step 1: Unzip folder and paste in your localhost or server.
  • Step 2: Open browser, then type the path where you pasted the app "http://your_app_path".
  • Step 3: Click browse and select the image file to upload and click on submit.
  • Step 4: Give desired width and height and click Submit
  • Step 5: Use marquee to select the area you need as thumbnail and click on crop.
  • Step 6: Ta-da! your image has been cropped.
  • Step 7: To download image, click on download icon on image hover.
  • Step 8: Cropped images will be stored in thumbnail folder

*Requires: PHP5


PHP Files (Top)


  1. lib/crop.php is a library which contains various function used under whole process.

    Usage:
    /*import library*/
    require_once('libs/crop.php');

    /*initial object - with path to your folder*/
    $crop = new Crop('./original/', './thumbnails/','./uploads/');

    /*Call to function */
    $crop->function_name();
  2. index.php contains a form you can use this form any where you want to integrated this tool.

  3. jcrop_main.php contains PHP Script which accepts the values posted from index.php using these values allow to compress the image and allows the image for cropping

  4. Attention!

    • thumbnails folder contains cropped images.
    • original folder contains original uploaded images with compressed size.
    • uploads folder is used to buffer the whole process.

    Our project requires all the above folders writeable. In your FTP client you can set you folder permissions to 777 or 0777.

JavaScripts (Top)


  • jquery Latest library
  • aspectratio.js - used for calculating aspect ratio using entered width and height.
  • custom.js - used for validating the form.
  • jcrop_main.js - Initialization of jcrop plug-in is done in this file and jcrop_main_tool.php file.
  • jquery.Jcrop.min.js - This file contains jcrop plug-in library.

Credits (Top)


  1. Jcrop » the jQuery Image Cropping Plugin Visit Site