Here it is:
I am trying to create a simple script that would take 2 images and merge the 2. They are a jpg image (the background) and a png image with alpha transparency as the foreground. Imagine it like layers of images in photoshop. I'd like to place the foreground on top the the background. I can either display the foreground or the background but can't display the foreground on top of the background.
Here is the code I've got so far:
Code: Select all
$base_dst = imagecreatetruecolor(47, 47);
imagealphablending($base_dst, false);
imagesavealpha($base_dst, true);
$base = imagecreatefromjpeg('images/icon_base.jpg');
imagecopyresampled($base_dst, $base, 0, 0, 0, 0, 47, 47, 47, 47);
$icon_dst = imagecreatetruecolor(47, 47);
imagealphablending($icon_dst, false);
imagesavealpha($icon_dst, true);
$icon = imagecreatefrompng('images/icons/64_64/icon01_13.png');
imagecopyresampled($icon_dst, $icon, 0, 0, 0, 0, 47, 47, 64, 64);
header('Content-Type: image/png');
imagepng($base_dst);