Superimpose Images with PHP

后端 未结 1 2013
说谎
说谎 2020-12-14 05:34

I am searching for a way to overlay an image on an existing image.

e.g:

\"img1\" +

相关标签:
1条回答
  • 2020-12-14 05:39

    You can do this using GD library. There is function to "merge" images called imagecopymerge.

    Here is a very simple example how to merge images:

    <?php
    header('Content-Type: image/jpeg');
    
    $bg = imagecreatefromjpeg('background.jpg');
    $img = imagecreatefromjpeg('image.jpg');
    
    imagecopymerge($bg, $img, 0, 0, 0, 0, imagesx($bg), imagesy($bg), 75);
    
    imagejpeg($bg, null, 100);
    ?>
    
    0 讨论(0)
提交回复
热议问题