[英]Merging (watermark) a jpg with png while resizing the png in PHP GD
I am sure I could somehow figure this out but it's just taking me way too long since I am not a PHP guy. 我确定我可以以某种方式解决这个问题,但是由于我不是PHP专家,所以花了我很长时间。 Hopefully someone can set up the script for me in minutes...
希望有人可以在几分钟内为我设置脚本...
So here's what I need to do: 所以这是我需要做的:
I transmit 2 pictures from a smartphone to a webserver. 我将2张图片从智能手机传输到Web服务器。 These 2 images need to be merged (watermarked).
这2张图片需要合并(加水印)。 They differ a little:
它们略有不同:
Now I need to merge these images. 现在,我需要合并这些图像。 The 2nd one (png) needs to be scaled to the 1st one's (jpeg) resolution.
第二个(png)需要缩放为第一个(jpeg)分辨率。
Please note 2 things: 请注意两件事:
So could anyone help me out on this? 那么有人可以帮我吗? Like I said, I've been messing around with a couple of GD functions but progress is far too slow.
就像我说的,我一直在搞一些GD函数,但是进展太慢了。 I guess I found the required functions with imagecopy and watermark .
我想我找到了imagecopy和watermark所需的功能。 But I don't find the right way to put 'em together.
但是我找不到将它们组合在一起的正确方法。
Thanks in advance, 提前致谢,
steff 斯蒂夫
Thanks a million 太感谢了
A few months ago i posted a function that does that, since the code is quite big i will just link my post, check it out here . 几个月前,我发布了一个执行此操作的函数,因为代码很大,所以我只链接我的帖子,请在此处查看 。 Make sure you don't do this onfly, it will overload your server, save the watermarked images or at least cache them.
确保不进行此操作,它会使服务器过载,保存带水印的图像或至少将其缓存。
If you also need to resize the original or watermark, i also posted a function to do this here . 如果您还需要调整原始大小或水印的大小,我也在此处发布了一个函数来执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.