doujiu9307 2011-01-06 21:43
浏览 89
已采纳

蒙太奇或GD图书馆的拼贴画

I'm trying to create a table of thumbnails for example 100 thumbnails 10x10 with GD Library. I saw that imagemagick has a montage function that would probably be useful but I'm wondering if GD library can do this as well.

I thought I could maybe do it by just outputting all of the images in a simple html table and converting that table to an image, but it appears that might not be possible. Any help or suggestions?

  • 写回答

2条回答 默认 最新

  • dou44364983 2011-01-06 22:54
    关注

    This is most certainly possible. You can resize images, as well as copy images into another image with GD. To find out more about resizing, check out this resize function I made: http://www.spotlesswebdesign.com/blog.php?id=1

    But let's say your images are already resized to 10x10, and you had an array filled with 100 urls leading to different 10x10 gifs.

    $montage_image = imagecreatetruecolor(100, 100);
    $x_index = 0;
    $y_index = 0;
    foreach($array_with_100_10x10_gif_urls as $gif_image_url) {
        $current_image = imagecreategif($gif_image_url);
        imagecopy($montage_image, $current_image, $x_index * 10, $y_index * 10, 0, 0, 10, 10);
        imagedestroy($current_image);
        $x_index++;
        if ($x_index > 9) {
            $x_index = 0;
            $y_index++;
        }
    }
    // place code for saving the montage image as a file or outputting to teh browser here.
    imagedestroy($montage_image);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料