Is there a PHP function that would allow me to superimpose an image over another one? If not, how can I accomplish this (not asking for code, just a list of steps)?
+2
A:
Use the GD graphics library. There is an example of creating a watermark, which is basically the same thing using the imagecopymerge()
function.
cletus
2009-09-26 15:16:37
+1 - for showing an example, rendering my answer obsolete. :)
James Black
2009-09-26 15:17:41
+4
A:
Hi,
I suppose there are functions provided by GD (generally enabled on PHP installations) that might do just that.
For instance, maybe one of imagecopy
or imagecopymerge
functions, I'd say.
See Example #1 Merging two copies of the PHP.net logo with 75% transparency on the manual page of the second one (quoting) :
<?php
// Create image instances
$dest = imagecreatefromgif('php.gif');
$src = imagecreatefromgif('php.gif');
// Copy and merge
imagecopymerge($dest, $src, 10, 10, 0, 0, 100, 47, 75);
// Output and free from memory
header('Content-Type: image/gif');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
There are also these two examples that might prove useful :
Pascal MARTIN
2009-09-26 15:17:19