Which image php extension install for dompdf

大憨熊 提交于 2020-01-05 04:31:09

问题


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.

Thanks.


回答1:


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.

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+ (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).



回答2:


i was facing same problem. i did 2 things.

  1. DOMPDF_ENABLE_REMOTE set to true at pdf\dompdf_config.custom.inc.php & pdf\dompdf_config.custom.inc.php

  2. i tried with .jpg file.

    it worked for me!!



来源:https://stackoverflow.com/questions/14328099/which-image-php-extension-install-for-dompdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!