Rubblewebs

THESE CODES ARE PROVIDED FOR AN EXAMPLE OF HOW TO USE IMAGEMAGICK WITH PHP. CARE SHOULD BE TAKEN WHEN ACCEPTING USER INPUT.

I TAKE NO RESPONSABILTY FOR ANY PROBLEMS THAT MAY OCCURE WHEN USING ANY OF THIS CODE.

IT IS UP TO YOU TO SECURE THE CODE AND VALIDATE USER INPUT.

Embossed watermark

Embossed watermark example
 
// Get the size of the image
$size = getimagesize("$input14");

// Size for watermark - scaled to fit the image
$width = $size[0]*.9;
$height = $size[0]*.25;

// Create an image with the text
$cmd = "-size {$width}x{$height} -background none -font Utopia-bold ".
" -fill white -gravity center caption:\"Copyright of Rubblewebs\" ".
" -shade 240x40";

exec("convert $cmd font.png ");

// Add the text image to the photo
exec("composite -watermark 30% -gravity south font.png $input14 embossed.png");

// Delete the tempory image
unlink ('font.png');

Back