Combine two images (.JPG) using PHP GD

穿精又带淫゛_ 提交于 2019-12-05 01:24:16

问题


I can't find a solution to this. I want to add 20px empty space to this image: http://img233.imageshack.us/img233/419/78317401.jpg

and then paste this watermark at the bottom (on the blank space)

So the output would be:

http://img252.imageshack.us/img252/4554/wynik.jpg

I don't want to stretch it.

EDIT

Did it with WIdeImage. Rly simple.


回答1:


Try wide image api http://wideimage.sourceforge.net/
Check out one of their this demo may be that help you
Merge and Resize




回答2:


1) Load both images with

http://www.php.net/manual/en/function.imagecreatefromjpeg.php

2) Get 1st image height and width with

http://www.php.net/manual/en/function.imagesy.php

http://www.php.net/manual/en/function.imagesx.php

3) Create larger image with height+20

http://www.php.net/manual/en/function.imagecreatetruecolor.php

4) Copy the first image and the second image to the larger image

http://www.php.net/manual/en/function.imagecopy.php

5) Save it

http://www.php.net/manual/en/function.imagejpeg.php

6) Done



来源:https://stackoverflow.com/questions/7906054/combine-two-images-jpg-using-php-gd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!