Combine 2-3 transparent PNG images on top of each other with PHP

后端 未结 5 1623
小蘑菇
小蘑菇 2020-12-04 11:17

I am working on a custom avatar system for a project, but I have never really done much with the image side of PHP. I assume I need to use GD in some way, but I have no ide

5条回答
  •  囚心锁ツ
    2020-12-04 11:54

    This helped me create a PNG image from 3 other PNG files to create a watermarked image with a background. Hope it helps someone else.


    $bgFile = __DIR__ . "/background-layer-1.png"; // 93 x 93

    Background Layer

    $imageFile = __DIR__ . "/icon-layer-2.png"; // 76 x 76

    Icon Image Layer

    $watermarkFile = __DIR__ . "/stars-layer-3.png"; // 133 x 133 (Is white stars)
    Watermark


    Outputs:

    Result

提交回复
热议问题