I put together the example below from the code at http://db.org/demo/2003/02/14/scale-and-overlay/. Hope its what you were looking for.
PHP Code:
<?php
$overlay = 'overlay.png'; //image to overlay i.e. arrow
$origimg = 'orig.png'; //image having the arrow added
$trans_r = 255;
$trans_g = 255;
$trans_b = 255;
if(!$overlay = imagecreatefrompng($overlay)) {
$error = 'error opening overlay image';
exit;
}
$orig = imagecreatefrompng($origimg);
$orig_x = imagesx($orig);
$orig_y = imagesy($orig);
$overlay_x = imagesx($overlay);
$overlay_y = imagesy($overlay);
$image_x = $orig_x;
$image_y = $orig_y;
$offset_x = 0;
$offset_y = 0;
$image = imagecreatetruecolor($image_x, $image_y);
imagecopyresampled($image, $orig, 0, 0, 0, 0, $image_x, $image_y, $orig_x, $orig_y);
imagecolortransparent($overlay, imagecolorallocate($overlay, $trans_r, $trans_g, $trans_b));
imagecopymerge($image, $overlay, $offset_x, $offset_y, 0, 0, $overlay_x, $overlay_y, 99);
imagepng($image, 'over.png');
?>
<html>
<body>
Overlayed image:<br />
<img src = "over.png">
</body>
</html>
Bookmarks