Adding watermarks to images

<?php$image=new\Phalcon\Image\Adapter\Gd('image.jpg');$watermark=new\Phalcon\Image\Adapter\Gd('me.jpg');// Put the watermark in the top left corner$offsetX=10;$offsetY=10;$opacity=70;$image->watermark($watermark,$offsetX,$offsetY,$opacity);$image->save('watermarked-image.jpg');

Of course, you can also manipulate the watermarked image before applying it to the main image:

<?php$image=new\Phalcon\Image\Adapter\Gd('image.jpg');$watermark=new\Phalcon\Image\Adapter\Gd('me.jpg');$watermark->resize(100,100);$watermark->rotate(90);$watermark->sharpen(5);// Put the watermark in the bottom right corner with a 10px margin$offsetX=($image->getWidth()-$watermark->getWidth()-10);$offsetY=($image->getHeight()-$watermark->getHeight()-10);$opacity=70;$image->watermark($watermark,$offsetX,$offsetY,$opacity);$image->save('watermarked-image.jpg');

Blurring images

The blur() method takes a single parameter - an integer between 0 (no effect) and 100 (very blurry):