Ejemplo n.º 1
0
function rotateImage($image, $deg, $output_image)
{
    $wm = new Watimage();
    $wm->setImage(array('file' => "files/{$image}", 'quality' => 90));
    // file to use and export quality
    $wm->rotate($deg);
    if (!$wm->generate("results/{$output_image}")) {
        // handle errors...
        print_r($wm->errors);
    }
}
Ejemplo n.º 2
0
$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'));
// Resize the image
$wm->resize(array('type' => 'resize', 'size' => 400));
// Flip it
$wm->flip('horizontal');
// Now rotate it 30deg
$wm->rotate(30);
// It's time to apply the watermark
$wm->applyWatermark();
// Export the file
if (!$wm->generate(OUTPUT . 'test7.png')) {
    // handle errors...
    print_r($wm->errors);
}
echo "All examples are now available under the 'output' folder\n";
// END OF FILE