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.

Composte text

Composte text example
 
// Create the text to use as a mask
$cmd = " -size 460x110 xc:none -font $font1 -pointsize 90 ".
" -draw \"gravity center fill black text 0,0 'Albir' \" ";
exec("convert $cmd mask.png");

// Lay the mask over the first image to create the text from the image
exec("composite -compose Dst_In mask.png -gravity center $input14 -matte text.png ");

//Lay the text over the second image
exec("composite -gravity center text.png $input13 composte.jpg ");

// Alternative method without temporary images - currently not working
// NOTE:- You need an extra - every time you use a miff:- |
/*
$cmd = "-size 460x110 xc:none -font $font1 -pointsize 90 -draw \"gravity center fill black text 0,0 'Albir' \" miff:- | composite - -compose Dst_In mask.png -gravity center $input14 -matte miff:- | composite - -gravity center text.png $input13 ";
exec("convert $cmd composte.jpg");
*/
// Delete tempory images
unlink("text.png");
unlink("mask.png");


Back