コード例 #1
0
ファイル: Watimage.php プロジェクト: elboletaire/watimage
/*******************
 *** FLIP IMAGES ***
 *******************/
$wm = new Watimage($image);
$wm->flip('vertical');
// or "horizontal"
if (!$wm->generate(OUTPUT . 'test5.png')) {
    // handle errors...
    print_r($wm->errors);
}
/***********************
 *** CROPPING IMAGES ***
 ***********************/
// Usefull for cropping plugins like https://github.com/tapmodo/Jcrop
$wm = new Watimage($image);
$wm->crop(array('width' => 500, 'height' => 500, 'x' => 50, 'y' => 80));
if (!$wm->generate(OUTPUT . 'test6.png')) {
    // handle errors...
    print_r($wm->errors);
}
/***************************
 *** EVERYTHING TOGETHER ***
 ***************************/
$wm = new Watimage();
// Set the image
$wm->setImage($image);
// you can also set the quality with setImage, you only need to change it with an array: array('file' => $image, 'quality' => 70)
// Set the export quality
$wm->setQuality(80);
// Set a watermark
$wm->setWatermark(array('file' => $watermark, 'position' => 'center center', 'margin' => array('x' => -20, 'y' => 10), 'size' => 'full'));