merging two images with php

merging two images with php  using -'php,image,merge,resize,overlay'

I'm trying to merge two images together with 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

Image Two

...and have it turn into this? FINAL RESULT:


asked Sep 15, 2015 by WillieAshhnu
0 votes

4 Answers

0 votes

I got it working from one I made.

answered Sep 15, 2015 by UnaWollaston
0 votes

Question is about merging two images, however in this specified case you shouldn't do that. You should put Content Image (ie. cover) into tag, and Style Image into CSS, why?

  1. As I said the cover belongs to the content of the document, while that vinyl record and shadow are just a part of the page styles.
  2. Such separation is much more convenient to use. User can easily copy that image. It's easier to index by web-spiders.
  3. Finally, it's much easier to maintain.

So use a very simple code:

Moving mountains by Pneuma
.cover { padding: 10px; padding-right: 100px; background: url(/style/images/cover-background.png) no-repeat; }
answered Sep 15, 2015 by ClaraMarrone
0 votes

Use the GD library or ImageMagick. I googled 'PHP GD merge images' and got several articles on doing this. In the past what I've done is create a large blank image, and then used imagecopymerge() to paste those images into my original blank one. Check out the articles on google you'll find some source code you can start using right away.

answered Sep 15, 2015 by LSYKarol3672
0 votes

The GD Image Manipulation Library in PHP is probably the best for working with images in PHP. Try one of the imagecopy functions (imagecopy, imagecopymerge, ...). Each of them combine 2 images in different ways. See the php documentation on imagecopy for more information.

answered Sep 15, 2015 by MicGreer