If you have the 2 separate images, you can do it with CSS.
I never attempted to combine two separate images before with code. I have done with you done with adding text to images as seen below and keep reading.
[php]<?
session_start();
$image = ImageCreateFromPNG(‘http://www.example.com/images/tags/ziggyfrontb_m.png’);
imagealphablending($image, true);
imagesavealpha($image, true);
//ImageString($image, 5, 33, 30, ‘LUKE’, $text_color);
//$grey = imagecolorallocate($image, 128, 128, 128);
//$black = imagecolorallocate($image, 0, 0, 0);
$grey = imagecolorallocate($image,hexdec(substr($_SESSION[‘bc’],0,2)), hexdec(substr($_SESSION[‘bc’],2,2)), hexdec(substr($_SESSION[‘bc’],4,2)));
$black = imagecolorallocate($image,hexdec(substr($_SESSION[‘fc’],0,2)), hexdec(substr($_SESSION[‘fc’],2,2)), hexdec(substr($_SESSION[‘fc’],4,2)));
$font = $_SESSION[‘fontselected’];
$pettagtext = $_SESSION[‘pettagtext’];
// Add some shadow to the text
imagettftext($image, 20, 0, 30, 55, $grey, $font, $pettagtext);
// Add the text
imagettftext($image, 20, 0, 28, 53, $black, $font, $pettagtext);
header(‘Content-Type: image/png’);
ImagePNG($image);
imagedestroy($image);
?>
[/php]
So here is some code to merge two images, which is similar to above and what you have been doing and uses the imagecopymerge function.
[php]<?php
$dest = imagecreatefrompng(‘vinyl.png’);
$src = imagecreatefromjpeg(‘cover2.jpg’);
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopymerge($dest, $src, 10, 9, 0, 0, 181, 180, 100); //have to play with these numbers for it to work for you, etc.
header(‘Content-Type: image/png’);
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
?>[/php]