Transparent PNG over JPG in PHP

前端 未结 2 2022
梦谈多话
梦谈多话 2020-12-21 02:21

What seems to be simple, isn\'t :(

I\'m trying to add something like a watermark (transparent png) on an image (jpg). This is the code I\'m using:

$w         


        
2条回答
  •  太阳男子
    2020-12-21 02:34

    Your $width and $height should be the dimensions of the watermark, not of the photo. What you're telling it to do is copy the watermark with a much bigger size than it is. When it reads part of an image that doesn't exist (coordinates out of bounds) the result is opaque black, giving the result you see.

提交回复
热议问题