| 
<?php     
include("class.imagedit.php");
 function crop1($url)
 {
 $image = new imagedit($url);
 $image->crop(
 40 /* x */
 , 80 /* y */
 , 400 /* width */
 , 100 /* height */
 );
 
 return $image->getPNG();
 }
 function crop2($url)
 {
 $image = new imagedit($url);
 $image->cropBorder(
 40 /* left */
 , 40 /* top */
 , 200 /* right */
 , 100 /* bottom */
 );
 
 return $image->getPNG();
 }
 function crop3($url)
 {
 $image = new imagedit($url);
 if( $image->hasFace() )
 $image->cropFace(
 true /* Optional: Preserve Aspect Ratio */
 );
 
 return $image->getJPG();
 }
 ?>
 <body style="background: yellow;">
 <h1>Imagedit Demo 2: Cropping</h1>
 <img style="border: 1px solid black;" src="data:image/png;base64,<?=base64_encode(crop1("test.png"))?>"></img>
 <img style="border: 1px solid black;"src="data:image/png;base64,<?=base64_encode(crop2("test.png"))?>"></img>
 <img style="border: 1px solid black;"src="data:image/jpg;base64,<?=base64_encode(crop3("portrait.png"))?>"></img>
 </body>
 |