funerr
funerr

Reputation: 8156

PHP | imagecopymerge() won't work

        $dest = imagecreatefromjpeg('image.jpg');
        $src = imagecreatefrompng('image2.png');

        // Copy and merge
        imagecopymerge($dest, $src, 50, 50, 0, 0, 30, 30, 75);

        imagepng($dest, '1.png');

        imagedestroy($dest);
        imagedestroy($src);

$dest = 50x50
$src = 30x30
1.png only shows the $dest image with out the $src on top of it.

Thanks in advance.

Upvotes: 0

Views: 1140

Answers (1)

greg0ire
greg0ire

Reputation: 23255

If dest is 50x50, then you're trying to copy from the bottom right corner, which has 50, 50 as coordinates.

 +-----------------------+
 |                       |
 |                       |
 |     you should copy   |
 |                       |
 |                       |
 |                       |
 |     there             |
 |                       |
 |                       |
 |                       |
 |                       |
 +-----------------------+-----------------------+
                         |                       |
                         |                       |
                         |    you're copying     |
                         |                       |
                         |                       |
                         |                       |
                         |                       |
                         |       here            |
                         |                       |
                         |                       |
                         |                       |
                         |                       |
                         +-----------------------+

Upvotes: 2

Related Questions