Home >Backend Development >PHP Tutorial > GD 函数合成图片有关问题(一张jpg,一张png)

GD 函数合成图片有关问题(一张jpg,一张png)

WBOY
WBOYOriginal
2016-06-13 12:38:02845browse

GD 函数合成图片问题(一张jpg,一张png)
RT:
请问用php怎么能合成两张图片呢?
一张是png 透明的底图,另一张是jpg 图片

现在想让jpg的图片合成到png的底图上面,成为一张新的图片,如何实现呢?

另外问下,是不是合成的图片要尺寸一样大呢?还是底图可以大点的?

本人在网上也找了一些方法,但好像都不行

  $path_1 = "topic_assets/522592b5d61cb_ip4.jpg";<br />
  $path_2 = "topic_assets/topic_border_android.png";<br />
	//echo $path_1;<br />
	$image=imagecreatefromjpeg($path_1);  <br />
	$wm=imagecreatefrompng($path_2);   <br />
	$im=imagecreatetruecolor(imagesx($image),imagesy($image));   <br />
	imagecopy($im,$image,0,0,0,0,imagesx($image),imagesy($image));   <br />
	imagecopy($im,$wm,0,0,0,0,imagesx($wm),imagesy($wm));


做过类似的,给个解决方案吧...

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn