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.

Scatterd photos

Scatterd photos example
 
 // Resize the image, add a 10px white border and save as a tempory image
exec("convert $input18 -resize 220x200 -bordercolor white -border 10x10 photo1.miff");
// Rotate the tempory image and save again
exec("convert photo1.miff -background none -rotate -25 photo10.miff");

// Can be done on one line which saves time 
exec("convert $input10 -resize 220x200 -bordercolor white -border 10x10 -background none -rotate 25 photo20.miff"); 

exec("convert $input19 -resize 220x200 -bordercolor white -border 10x10 photo3.miff");
exec("convert photo3.miff -background none -rotate 20 photo30.miff"); 

exec("convert $input17 -resize 220x200 -bordercolor white -border 10x10 photo4.miff");
exec("convert photo4.miff -background none -rotate -20 photo40.miff"); 

// Generate the background combined image from the tempory images above
$cmd =" -size 700x400 xc:#262b38  photo10.miff -geometry +2+2 -composite photo40.miff -geometry +410+140 ".
" -composite photo20.miff -geometry +360+20 -composite photo30.miff -geometry +150+130 -composite ";

exec("convert $cmd composite_background.jpg");

// Delete tempory images 
foreach ( glob( "*.miff" ) as $filename ) { 
unlink( $filename );  
} 


Back