我确信我可以以某种方式解决这个问题,但这花了我太长时间,因为我不是 PHP 人员。希望有人可以在几分钟内为我设置脚本...
所以这就是我需要做的:
我将 2 张图片从智能手机传输到网络服务器。这两个图像需要合并(加水印)。它们略有不同:
- 图片是 2 兆像素的 jpg(持有照片)
- 图片是 480x800 像素的 png,具有透明背景(持有简单的手指绘画)
现在我需要合并这些图像。第二个 (png) 需要缩放到第一个 (jpeg) 的分辨率。
请注意两件事:
- 我只能使用服务器上安装的 GD 库。 Imagick 或类似的工具不可用
- 我很清楚第二张图像的质量不会很好。没关系。
那么有人可以帮我解决这个问题吗?就像我说的,我一直在摆弄几个 GD 函数,但进展太慢了。我想我找到了所需的功能 imagecopy 和 水印。但我找不到将它们组合在一起的正确方法。
预先感谢,
员工
谢谢一百万
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. 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. These 2 images need to be merged (watermarked). They differ a little:
- picture is a 2 megapixel jpg (holding a photo)
- picture will be a png of 480x800 pixels with a transparent background (holding a simple finger painting)
Now I need to merge these images. The 2nd one (png) needs to be scaled to the 1st one's (jpeg) resolution.
Please note 2 things:
- I can only use the GD library that is installed on the server. Imagick or alike is not available
- I am well aware of the fact that the 2nd image's quality won't be brilliant. That's okay.
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. I guess I found the required functions with imagecopy and watermark. But I don't find the right way to put 'em together.
Thanks in advance,
steff
Thanks a million
发布评论
评论(1)
几个月前,我发布了一个执行此操作的函数,由于代码相当大,我将链接我的帖子,查看一下 此处。确保您不要立即执行此操作,它会使您的服务器超载,保存带水印的图像或至少缓存它们。
如果您还需要调整原始或水印的大小,我还发布了一个函数来执行此操作 此处。
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.