PHP Image Overlay

Is there a PHP function that would allow me to overlay an image on top of another? If not, how can I accomplish this (without asking for code, just a list of steps)?

+3
source share
2 answers

I believe that there are functions provided by GD (usually included in PHP installations) that can do just that.

For example, perhaps one of imagecopyor imagecopymerge, I would say.

See Example # 1 Combining two copies of the PHP.net logo with 75% transparency on the second page of the man page (citation):

<?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 two examples that may prove useful:

+6
+2

Source: https://habr.com/ru/post/1718601/


All Articles