<tfoot id='u2QOt'></tfoot>
    • <bdo id='u2QOt'></bdo><ul id='u2QOt'></ul>
  1. <i id='u2QOt'><tr id='u2QOt'><dt id='u2QOt'><q id='u2QOt'><span id='u2QOt'><b id='u2QOt'><form id='u2QOt'><ins id='u2QOt'></ins><ul id='u2QOt'></ul><sub id='u2QOt'></sub></form><legend id='u2QOt'></legend><bdo id='u2QOt'><pre id='u2QOt'><center id='u2QOt'></center></pre></bdo></b><th id='u2QOt'></th></span></q></dt></tr></i><div id='u2QOt'><tfoot id='u2QOt'></tfoot><dl id='u2QOt'><fieldset id='u2QOt'></fieldset></dl></div>
    <legend id='u2QOt'><style id='u2QOt'><dir id='u2QOt'><q id='u2QOt'></q></dir></style></legend>

      <small id='u2QOt'></small><noframes id='u2QOt'>

      如何通过 PHP 将 3 个图像合并为 1 个图像?

      时间:2023-10-04
      <i id='K4nAU'><tr id='K4nAU'><dt id='K4nAU'><q id='K4nAU'><span id='K4nAU'><b id='K4nAU'><form id='K4nAU'><ins id='K4nAU'></ins><ul id='K4nAU'></ul><sub id='K4nAU'></sub></form><legend id='K4nAU'></legend><bdo id='K4nAU'><pre id='K4nAU'><center id='K4nAU'></center></pre></bdo></b><th id='K4nAU'></th></span></q></dt></tr></i><div id='K4nAU'><tfoot id='K4nAU'></tfoot><dl id='K4nAU'><fieldset id='K4nAU'></fieldset></dl></div>
          • <bdo id='K4nAU'></bdo><ul id='K4nAU'></ul>
            <legend id='K4nAU'><style id='K4nAU'><dir id='K4nAU'><q id='K4nAU'></q></dir></style></legend>

            <tfoot id='K4nAU'></tfoot>

          • <small id='K4nAU'></small><noframes id='K4nAU'>

                <tbody id='K4nAU'></tbody>
                本文介绍了如何通过 PHP 将 3 个图像合并为 1 个图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我真的找不到成功的方法.我在谷歌上搜索过这个,它要么在图像周围有黑色阴影,要么所有图像都不重叠.你能帮忙吗?

                I really cannot find a way to successfully do it.. I've searched google for this and it either has black shades around the images or all the images don't overlap. Could you please help?

                我擅长 PHP;我会给自己 2/5.. 如果有人愿意帮助我,我真的很感激.

                I am alright at PHP; I'd give myself a 2/5.. I would really appreciate if someone would be willing to help me out.

                我正在寻找一个简单的 api,类似于:

                I'm looking for a simple api that goes something like:

                $color=$_GET['color'];
                $face=$_GET['face'];
                $hat=$_GET['hat'];
                
                echo '<img src="avatar.php?color=$color&face=$face&hat=$hat">';
                

                提前感谢您的任何帮助.我也可以通过我对其他语言的了解来理解 php,所以不要害怕和我谈论技术;但不要太技术化.

                Thanks for any help in advance. I can understand php from my knowledge of other languages, too, so don't be afraid to talk technical with me; but not too technical.

                推荐答案

                关于这个答案的评论太多了,所以我把它作为答案发布.

                there are so many comments on this answer so I'm posting this as an answer.

                让它在我的电脑上工作.

                Got it working on my pc.

                使用斯文代码:

                    $images = array( $_GET['color'], $_GET['face'], $_GET['hat'] );
                
                    // Allocate new image
                    $img = imagecreatetruecolor(58, 75);
                    // Make alpha channels work
                    imagealphablending($img, true);
                    imagesavealpha($img, true);
                
                    foreach($images as $fn) {
                        // Load image
                        $cur = imagecreatefrompng($fn);
                        imagealphablending($cur, true);
                        imagesavealpha($cur, true);
                
                        // Copy over image
                        imagecopy($img, $cur, 0, 0, 0, 0, 58, 75);
                
                        // Free memory
                        imagedestroy($cur);
                    }   
                
                    header('Content-Type: image/png');  // Comment out this line to see PHP errors
                    imagepng($img);
                
                ?>
                

                我像这样重命名了你的图片,这样更容易:

                I renamed your images like this so its easier :


                微笑:a.png
                耳机:b.png
                蓝色:c.png


                smile : a.png
                headset : b.png
                blue : c.png

                原来问题在于它的分层.把一个放在另一个后面

                重命名图像后,使用此 url -- 它将起作用(在我的 PC 上起作用).

                after you rename the images, use this url -- it will work(works on my pc).

                YOUR_FILE.php?hat=b.png&color=c.png&face=a.png

                YOUR_FILE.php?hat=b.png&color=c.png&face=a.png

                这仍然会给你一个黑色的背景.我不确定您在服务器上的文件中是否具有与上述完全相同的代码 - 因为我在您的链接上使用了图像顺序,但它没有帮助.尝试将此完全相同的代码复制粘贴到不同的文件上,然后尝试.处理订单并检查结果.

                This will still give you a black background. I am not sure if you have the exact same code as above in your file on the server - because I played around with the image order on your link and it does not help. Try copy-pasting this exact same code on a different file and then trying. Play around with the order and check the results.

                这篇关于如何通过 PHP 将 3 个图像合并为 1 个图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:合并两个 mp3 php 下一篇:将 2 pdf 与 Zend Framework 合并

                相关文章

                最新文章

                1. <small id='WPXbU'></small><noframes id='WPXbU'>

                2. <tfoot id='WPXbU'></tfoot>

                    <legend id='WPXbU'><style id='WPXbU'><dir id='WPXbU'><q id='WPXbU'></q></dir></style></legend>
                  1. <i id='WPXbU'><tr id='WPXbU'><dt id='WPXbU'><q id='WPXbU'><span id='WPXbU'><b id='WPXbU'><form id='WPXbU'><ins id='WPXbU'></ins><ul id='WPXbU'></ul><sub id='WPXbU'></sub></form><legend id='WPXbU'></legend><bdo id='WPXbU'><pre id='WPXbU'><center id='WPXbU'></center></pre></bdo></b><th id='WPXbU'></th></span></q></dt></tr></i><div id='WPXbU'><tfoot id='WPXbU'></tfoot><dl id='WPXbU'><fieldset id='WPXbU'></fieldset></dl></div>
                    • <bdo id='WPXbU'></bdo><ul id='WPXbU'></ul>