PHP imagemagic imagick example
Here is a PHP imagemagic imagick example howto tutorial that is a mashup of the cloudmade openstreetmap api and the google chart api showing use of the compositeimage function !
<?php
require 'apikey.php';
$styles=array(1,2,4,6681);
$x = $_REQUEST['x'];
if ($x<10000 or $x>20000) $x=17590;
$y = $_REQUEST['y'];
if ($y<10000 or $y>20000) $y=10750;
$s = $_REQUEST['s'];
if (!in_array($s,$styles)) $s=$styles[0];
$cloud="http://tile.cloudmade.com/$apikey/$s/256/15/";
$googl='http://chart.apis.google.com/chart?cht=qr&chs=90x90&chl=http://geotagads.com/';
$image=new Imagick();
$image->newImage(512,512,new ImagickPixel('black'));
$image->setImageFormat('png');
for ($row=0;$row<=1;$row++) {
$yy=$y+$row;
for ($col=0;$col<=1;$col++) {
$xx=$x+$col;
$f="$cloud/$xx/$yy.png";
$i=new Imagick($f);
$image->compositeImage($i,imagick::COMPOSITE_COPY,256*$col,256*$row);
}
}
$f="$googl/?x=$x&y=$y";
$i=new Imagick($f);
$image->compositeImage($i,imagick::COMPOSITE_COPY,400,400);
header('Content-type: image/png');
echo $image;
?>
require 'apikey.php';
$styles=array(1,2,4,6681);
$x = $_REQUEST['x'];
if ($x<10000 or $x>20000) $x=17590;
$y = $_REQUEST['y'];
if ($y<10000 or $y>20000) $y=10750;
$s = $_REQUEST['s'];
if (!in_array($s,$styles)) $s=$styles[0];
$cloud="http://tile.cloudmade.com/$apikey/$s/256/15/";
$googl='http://chart.apis.google.com/chart?cht=qr&chs=90x90&chl=http://geotagads.com/';
$image=new Imagick();
$image->newImage(512,512,new ImagickPixel('black'));
$image->setImageFormat('png');
for ($row=0;$row<=1;$row++) {
$yy=$y+$row;
for ($col=0;$col<=1;$col++) {
$xx=$x+$col;
$f="$cloud/$xx/$yy.png";
$i=new Imagick($f);
$image->compositeImage($i,imagick::COMPOSITE_COPY,256*$col,256*$row);
}
}
$f="$googl/?x=$x&y=$y";
$i=new Imagick($f);
$image->compositeImage($i,imagick::COMPOSITE_COPY,400,400);
header('Content-type: image/png');
echo $image;
?>
generates

REFERRERS
ImageK