【问题标题】:Insert Image file into php's imagecreate将图像文件插入 php 的 imagecreate
【发布时间】:2013-05-22 08:13:48
【问题描述】:

我正在尝试动态生成一个由其他较小图像组成的图像文件。这是我目前得到的代码

    if ( function_exists('imagecreate') ) {
        header ("Content-type: image/png");
        $im = @imagecreate ($imgWidth, $imgHeight)
            or die ("Cannot initialize new GD image stream");
        $background_color = imagecolorallocate ($im, 255, 255, 255);
        $text_color = imagecolorallocate ($im, 0,0,0);
        imagepng ($im);
        imagedestroy($im);
    }

到目前为止,一切正常。我只是不知道如何将较小的图像包含到这个新的、更大的、动态生成的图像中。有谁知道如何做到这一点?理想情况下,执行此操作的函数(或其他函数)会要求我提供图像文件,即第二个图像文件中的 x 和 y 位置。

有什么建议吗?我真诚地感谢你能给我带来的任何帮助。非常感谢!!

【问题讨论】:

  • GD 包括从文件中读取图像的功能,如果这就是您所说的。它在文档中。 :)
  • 是的,我找到了 imagecopy() 的文档并且能够这样做。谢谢!!

标签: php image dynamic-image-generation


【解决方案1】:

Imagecopymerge 可能就是你要找的东西

【讨论】:

  • 谢谢!我最终使用了 imagecopy(),但由于您的建议,我得到了它。它工作正常:) 再次感谢!
猜你喜欢
  • 2019-07-08
  • 1970-01-01
  • 1970-01-01
  • 2016-01-23
  • 1970-01-01
  • 2017-02-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多