用PHP合并两个图像 [英] Merging two images with PHP
本文介绍了用PHP合并两个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将两个图像与PHP合并。
I'm trying to merge two images together with PHP.
例如......我将如何将图像置于图像2或合并之上,用基本的PHP?
我尝试过像水印这样的东西,但它似乎没有用。
For example... how would I go about placing image one on top of image two or merge, with basic PHP? I have tried something such as watermarking, but it doesn't seem to be working.
Image One
图片二
...让它变成这个? 最终结果:
...and have it turn into this? FINAL RESULT:
推荐答案
我从一个人那里得到了它。
I got it working from one I made.
<?php
$dest = imagecreatefrompng('vinyl.png');
$src = imagecreatefromjpeg('cover2.jpg');
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopymerge($dest, $src, 10, 9, 0, 0, 181, 180, 100); //have to play with these numbers for it to work for you, etc.
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
?>
这篇关于用PHP合并两个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文