This is for fun and a gem if needed.
<?php
error_reporting(E_ALL);
// LOCATION OF THE IMAGES (COULD COME IN FROM $_GET URL STRING)
$original = 'path/to/image.png';
$overlay = 'path/to/another/image.png';
// READ THE IMAGE AND THE OVERLAY FILE
// MAN PAGE http://php.net/manual/en/function.imagecreatefrompng.php
$im = ImageCreateFromPNG($original);
$wm = ImageCreateFromPNG($overlay);
// ADD OVERLAY USING LOCAL FUNCTION
imagelogo($im, $wm, imagesx($im), imagesy($im), imagesx($wm), imagesy($wm));
// SHOW THE IMAGE
header('Content-type: image/png');
ImagePNG($im);
// A FUNCTION TO ADD THE OVERLAY
// SEE http://php.net/manual/en/function.imagealphablending.php#77085
function imagelogo (&$dst_image, $src_image, $dst_w, $dst_h, $src_w, $src_h)
{
ImageAlphaBlending($dst_image,TRUE);
ImageAlphaBlending($src_image,TRUE);
ImageCopy
( $dst_image
, $src_image
, 0
, ($dst_h-$src_h)
, 0
, 0
, $src_w
, $src_h
)
;
}
Nice? 🙂