Hi,
I'm generating a form to select various product options and would like them displayed in an image.
Eventually I'll use javascript to update the image inside a div tag as the user changes options. (I've done this part before)
Anyway I've gotten as far as merging two files togeather, basically one is a picture of an exhibition stand and the other is the same size but only has a cut out of the floor colour (I thought this would be a good test) and a white background. I did start with transparent backgrounds but the imageCopyMerge couldn't deal with it.
As you may be able to see from the code below I've currently got this working with a 30% transparency index, but what I really want is the various options I specify to overlay (100%) the base/source image.
Has anyone had any experience in doing this?
Thanks in advance,
Humous.
I'm generating a form to select various product options and would like them displayed in an image.
Eventually I'll use javascript to update the image inside a div tag as the user changes options. (I've done this part before)
Anyway I've gotten as far as merging two files togeather, basically one is a picture of an exhibition stand and the other is the same size but only has a cut out of the floor colour (I thought this would be a good test) and a white background. I did start with transparent backgrounds but the imageCopyMerge couldn't deal with it.
As you may be able to see from the code below I've currently got this working with a 30% transparency index, but what I really want is the various options I specify to overlay (100%) the base/source image.
Has anyone had any experience in doing this?
Thanks in advance,
Humous.
PHP:
<?php
header("Content-type: image/png");
$floorcol = $_GET['floorcol'];
$sourcefile_id = imagecreatefrompng("standtest.png");
switch ($floorcol)
{
case 'red':
$insertfile_id = imagecreatefrompng("standtest_red.png");
break;
case 'blue':
$insertfile_id = imagecreatefrompng("standtest_blue.png");
break;
case 'green':
$insertfile_id = imagecreatefrompng("standtest_green.png");
break;
default:
$insertfile_id = imagecreatefrompng("standtest_red.png");
}
$sourcefile_width=imageSX($sourcefile_id);
$sourcefile_height=imageSY($sourcefile_id);
$insertfile_width=imageSX($insertfile_id);
$insertfile_height=imageSY($insertfile_id);
$transition=30;
imageCopyMerge($sourcefile_id, $insertfile_id,0,0,0,0,$insertfile_width,$insertfile_height,$transition);
imagepng($sourcefile_id);
imagedestroy($sourcefile_id);
$imageaccess=$_GET['imageaccess'];
?>