为dompdf安装哪个图片php扩展 [英] Which image php extension install for dompdf

查看:141
本文介绍了为dompdf安装哪个图片php扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 dompdf 创建一个pdf,但是当它出现时我收到此错误尝试添加图像。

I am trying to create a pdf with dompdf but I get this error when it is trying to add an image.

Uncaught exception 'DOMPDF_Exception' with message 'Function imagecreatefromgif() not found.  Cannot convert gif image: E:\APBPEVALUACIONDES/imagenes/header.gif.  Please install the image PHP extension.' in E:\APBPEVALUACIONDES\dompdf6\include\cpdf_adapter.cls.php:470

任何人都可以建议我这个错误的扩展。

Any one could suggest me the extension for this error.

谢谢。

推荐答案

imagecreatefromgif() GD PHP扩展程序的一部分。在dompdf 0.5.1或更早版本中,如果你坚持使用PNG,你可以在没有GD的情况下离开,但是在0.6.0 GD中几乎是一个要求。除非您的文档不包含图像,否则显然会这样做。

imagecreatefromgif() is part of the GD PHP extension. In dompdf 0.5.1 or earlier you could get away without GD if you stuck to PNG, but in 0.6.0 GD is pretty much a requirement. Unless your document does not include images, which it obviously does.

检查您的PHP配置。只要您使用0.6.0,您就可以在配置页面中查找位于dompdf / www / setup.php的任何其他红旗(通过您的网络服务器访问)。

Check your PHP configuration. So long as you're using 0.6.0 you can look for any other red flags in the configuration page located at dompdf/www/setup.php (accessed via your web server).

仅供参考,以下是全功能要求的快速概述:

And just FYI, here's a quick rundown of the requirements for full functionality:


  • PHP5 +(必填)

  • DOM扩展(必填,默认启用)

  • GD扩展

  • MBString扩展

  • allow_url_fopen 设置为true,如果您需要访问远程文件(使用带域的URL进行文件引用,例如 http://example.com/image.png )。托管服务提供商有时会禁用此功能。

  • 运行dompdf(通常是您的Web服务器)的进程对DOMPDF_TEMP_DIR,DOMPDF_FONT_DIR和DOMPDF_FONT_CACHE指定的目录进行读/写访问。

  • PHP5+ (required)
  • DOM extension (required, enabled by default)
  • GD extension
  • MBString extension
  • allow_url_fopen set to true if you need to access "remote" files (that would be file references using a URL with domain, e.g. http://example.com/image.png). This is sometimes disabled by hosting providers.
  • read/write access to the directories specified by DOMPDF_TEMP_DIR, DOMPDF_FONT_DIR, and DOMPDF_FONT_CACHE by the process running dompdf (typically your web server).

这篇关于为dompdf安装哪个图片php扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆