PHP Classes

Crop Image Plugin: Crop an image to a given position and size

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 57%Total: 395 This week: 1All time: 6,608 This week: 560Up
Version License PHP version Categories
crop-image-plugin 1.0.1GNU General Publi...5.0PHP 5, Graphics
Description 

Author

This class can crop an image to a given position and size.

It can take a given image file in GIF, JPEG or PNG format and creates a new image that is cropped from the original at given coordinates, width and height.

The package uses a jQuery plugin to send to the server the image and the crop coordinates via AJAX.

Picture of manudg
  Performance   Level  
Name: manudg <contact>
Classes: 6 packages by
Country: Spain Spain
Age: 43
All time rank: 159033 in Spain Spain
Week rank: 416 Up14 in Spain Spain Up

Example

<?php
/* Copyright 2015 Crop Image Plugin (email : manudg_1@msn.com)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

require "cropImage.class.php";

$image_src = $_POST["image"];
$new_image_src = "thumb/thumb-".basename($image_src);
$width = intval($_POST["width"]);
$height = intval($_POST["height"]);
$x = intval($_POST["x"]);
$y = intval($_POST["y"]);

/* Set options */
$options = array(
   
'image_src' => $image_src,
   
'new_image_src' => $new_image_src,
   
'width' => $width,
   
'height' => $height,
   
'x' => $x,
   
'y' => $y,
);

$cropImage = new cropImage($options);

?>
<h3>Cropped image saved in the folder thumb :)</h3>
<hr />
<img src="<?php echo $cropImage->getNewImage() ?>" />


Details

crop-image-plugin - PHP + jQuery UI + Ajax

<p>This class can crop an image to a given position and size.</p> <p>It can take a given image file in GIF, JPEG or PNG format and creates a new image that is cropped from the original at given coordinates, width and height.</p> <p>The package uses a jQuery plugin to send to the server the image and the crop coordinates via AJAX.</p>

<ul> <li>· Supported image types: jpg, jpeg, png and gif</li> <li>· Requeriments: PHP 5.x and GD Graphics Library</li> </ul>

<img src="https://github.com/ManuDavila/crop-image-plugin/blob/master/screenshot.jpg" />


Screenshots  
  • screenshot
  Files folder image Files  
File Role Description
Files folder imageimages (3 files)
Files folder imagethumb (1 file)
Accessible without login Plain text file cropImage.ajax.php Example Example script
Plain text file cropImage.class.php Class Class source
Accessible without login Plain text file index.php Aux. Example script
Accessible without login Plain text file README.md Data Auxiliary data
Accessible without login Image file screenshot.jpg Data Auxiliary data

  Files folder image Files  /  images  
File Role Description
  Accessible without login Image file gif.GIF Icon Icon image
  Accessible without login Image file jpg.jpg Icon Icon image
  Accessible without login Image file png.png Icon Icon image

  Files folder image Files  /  thumb  
File Role Description
  Accessible without login Plain text file hello-world.txt Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 90%
Total:395
This week:1
All time:6,608
This week:560Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:57%StarStarStar
Rank:1655