PHP | imagecopymerge()不起作用

时间:2011-09-30 17:43:03

标签: php php-gd

        $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只显示$ dest图像,而不显示$ src。

提前致谢。

1 个答案:

答案 0 :(得分:2)

如果dest是50x50,那么你试图从右下角复制,其中有50,50作为坐标。

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