PHP | imagecopymerge() 不起作用

发布于 2024-12-08 01:22:56 字数 393 浏览 5 评论 0原文

        $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);

$目的地 = 50x50
$src = 30x30
1.png 仅显示 $dest 图像,上面不显示 $src。

提前致谢。

        $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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

童话 2024-12-15 01:22:56

如果 dest 是 50x50,那么您将尝试从右下角复制,该右下角的坐标为 50, 50。

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

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            |
                         |                       |
                         |                       |
                         |                       |
                         |                       |
                         +-----------------------+
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文