0

I'm uploading and resizing an image via phpThumb class. What I need to do is to add my logo at bottom of this image. I don't want it to be a watermark, I would like to connect the two images.

-------------------
|  image 1        |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
-------------------
|  image 2        |
|                 |
|                 |
-------------------

Could You please give me advice on what is the fastest and the easiest way? I will have my logo in png format and the image will be a png or jpg.

Jacxel
  • 1,634
  • 8
  • 22
  • 33

1 Answers1

0

Here is an example of appending two images, in this case the widths must be the same.

$img1src = "img1.jpg"; 
$img2src = "img2.jpg"; 
$img1 = imagecreatefromjpeg($img1src); 
$img1W = imagesx($img1); 
$img1H = imagesy($img1); 
$img2 = imagecreatefromjpeg($img2src); 
$img2W = imagesx($img2); 
$img2H = imagesy($img2); 
$targetimg = imagecreatetruecolor($img1W,$img1H+$img2H); 
imagecopy($targetimg, $img1, 0, 0, 0, 0, $img1W,$img1H); 
imagecopy($targetimg, $img2, 0, $img1H, 0, 0, $img2W, $img2H); 
header('content-type: image/jpg');
imagejpeg($targetimg); 
gunnx
  • 1,229
  • 7
  • 16