PHP Classes

File: crop.php

Recommend this page to a friend!
  Classes of Danish Satti   Upload and Crop   crop.php   Download  
File: crop.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Upload and Crop
Validate and crop uploaded images files
Author: By
Last change: Update of crop.php
Date: 2 months ago
Size: 741 bytes
 

Contents

Class file image Download
<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

if(isset($_POST['action']) && $_POST['action']=='handle_crop'){
   
    require_once
dirname(__FILE__).'/classes/ImageCropper.php';
       
   
$cropper = new ImageCropper();
   
$src_a = explode(".",$_POST['src']);
   
$ext = array_pop($src_a);
   
$output = implode(".", $src_a)."_tn.".$ext;
    if(isset(
$_POST['path_to_dest']) && trim($_POST[''])!='path_to_dest'){
       
$cropper->setPathToDest(trim($_POST['path_to_dest']));
    }
    if(
$cropper->crop($_POST['src'], $output, $_POST['x'], $_POST['y'], $_POST['w'], $_POST['h'])){
        echo
$cropper->getCroppedImage();
    } else {
        echo
"error";
    }
   
}
?>