spliceimage( $w, $h, $ul_x, $ul_y); } } ################## if ( $_GET[action] == "Chop" ) { foreach ($image as $frame) { $frame->chopimage( $w, $h, $ul_x, $ul_y); } } ################## if ( $_GET[action] == "Crop" ) { foreach ($image as $frame) { $frame->cropimage( $w, $h, $ul_x, $ul_y); } } ################## # Reset geometry foreach ($image as $frame) { $frame->setimagepage( $w, $h, 0, 0); } $format = strtolower( $image->getimageformat() ); $path = "temp/$ID.$_SESSION[views].$format"; $frames = $image->getNumberImages(); if ( $frames > 1) { $image->writeImages("$path", TRUE); } else { $image->writeImage("$path"); } # save settings $_SESSION[path] = $path; header("Location: display.php"); exit; # end crop } ############ step 2 # if 2nd coorids not set, set var for form if ( $_GET[crop_image_x] && $_GET[crop_image_y] && $_GET[ul_x] && $_GET[ul_y] && !$_GET[lr_x] && !$_GET[lr_y] ) { $ul_x = $_GET[ul_x]; $ul_y = $_GET[ul_y]; $lr_x = $_GET[crop_image_x]; $lr_y = $_GET[crop_image_y]; header("location:$self?ul_x=$ul_x&ul_y=$ul_y&lr_x=$lr_x&lr_y=$lr_y"); exit; } # Step 1. # Vars shouldn't be set at this point # if 1st coorids not set, set vars for form if ($_GET[crop_image_x] && $_GET[crop_image_y] && !$_GET[ul_x] && !$_GET[ul_x] && !$_GET[lr_x] && !$_GET[lr_x] ) { $ul_x = $_GET[crop_image_x]; $ul_y = $_GET[crop_image_y]; header("location:$self?ul_x=$ul_x&ul_y=$ul_y"); exit; } ?> <? echo "$h1: $h2"; ?>

"; echo "No image"; echo ""; } ?>
"; echo "
"; echo "Your Image
"; list($width, $height, $type, $attr) = getimagesize("$_SESSION[path]"); echo "

Width = $width; Height = $height
"; ### Show file size $filesize = filesize("$_SESSION[path]"); echo "File size: $filesize bytes

"; } ?>
Upper Left
X Y
Lower Right X Y
Crop
Extracts a region of the image. [Example]
Chop
Removes a region of an image and collapses the image to occupy the removed portion. [Example]
Splice
Splices a solid color into the image. [Example]

Instructions

You can crop, chop or splice an image two ways; enter the cooridinates or point and click. Entering the cooridinates is more precise, point and click is easier.

Enter Cooridinates

  1. Enter the x,y cooridinates of the upper left corner of the area to be cropped.
  2. Enter the x,y cooridinates of the lower right corner of the area to be cropped or chopped.
  3. Click Crop or Chop.

Point And Click

  1. Click the the upper left corner of the area to be cropped.
  2. Click the lower right corner of the area to be cropped.
  3. Click Crop or Chop.