PHP: How to draw an image over another image?

I use the PHP and GD libraries.

I want to draw an image (let's say this: http://www.gravatar.com/avatar/107f2fafb2d29fedc3783b141139a878?s=128&d=identicon&r=PG ) using another image: http://www.geekpedia.com/gallery/fullsize/simplistic- windows-wallpaper.jpg in specific coordinates (top left or top right or anywhere on the image).

How to do this using the PHP and GD libraries.

+3
source share
2 answers

imagecopy () or imagecopymerge () . The documentation also provides examples.

+4
source

imagecopyresampled() or imagecopyresized() should do exactly what you want.
(Despite its name, imagecopyresampled also resizes.)
They take some or all of the original image, resize it and copy it to the target image. If the original image is not square, you can crop or distort it when copying it.

+1
source

Source: https://habr.com/ru/post/1312286/


All Articles