php Fatal error: Call to undefined function imagecreatefromjpeg()
发布:smiling 来源: PHP粉丝网 添加日期:2015-04-04 14:41:45 浏览: 评论:0
imagecreatefromjpeg函数是一个图像处理函数,但在使用中发现Fatal error: Call to undefined function imagecreatefromjpeg()错误了,下文小编整理了一些教程,大家一起来看看吧.
代码如下:
- if(!imagecreatefromjpeg("./testimg.jpg"))
- {
- echo "imagecreatefromjpeg(testimg.jpg) failed!n)";
- } //开源软件:phpfensi.com
- else
- {
- echo "imagecreatefromjpeg(testimg.jpg) succn)";
- }
如果你使用此函数提示php Fatal error: Call to undefined function imagecreatefromjpeg()
这个错误是因为没有安装gd 的jpeg,虽然你用phpinfo 查看有gd但 gd 不支持 jpeg,安装前我的phpinfo 如下:
- gd
- GD Support enabled
- GD Version bundled (2.0.34 compatible)
- FreeType Support enabled
- FreeType Linkage with freetype
- FreeType Version 2.2.1
- GIF Read Support enabled
- GIF Create Support enabled
- PNG Support enabled
- libPNG Version 1.2.10
- WBMP Support enabled
- XBM Support enabled
显然gd 没有支持jpeg 的,下面要安装 gd中的 jpeg,代码如下:
1、找到php 源码目录
2、进入 ext/gd 目录
3、/usr/local/php/bin/phpize
4、./configure –with-php-config=/usr/local/php/bin/php-config –with-jpeg-dir –with-freetype-dir
5、make && make install
6、重启 httpd
安装后查看phpinfo
- gd
- GD Support enabled
- GD Version bundled (2.0.34 compatible)
- FreeType Support enabled
- FreeType Linkage with freetype
- FreeType Version 2.2.1 //开源软件:phpfensi.com
- GIF Read Support enabled
- GIF Create Support enabled
- JPEG Support enabled
- libJPEG Version 6b
- PNG Support enabled
- libPNG Version 1.2.10
- WBMP Support enabled
- XBM Support enabled
很显然多了个 JPEG Support enabled
以windows下的php+apache:
首先,打开php.ini,找到“extension=php_gd.dll”,然后去掉前面的“;”注释,重启apache即可.
如果还出现此类问题,先检查php.ini的extension_dir值是哪个目录,在那个目录下检查有无php_gd.dll,没有的话请下载php_curl.dll,再把php目录中的libeay32.dll和ssleay32.dll拷到c:windowssystem32里面,重启apache,OK!
Tags: Fatal error:Call undefined
相关文章
- ·Fatal error: Call to undefined function curl_init(2013-11-28)
- ·Fatal error: Cannot redeclare 常见问题(2013-11-29)
- ·php中Fatal error: Class ZipArchive not found的解决办法(2013-12-02)
- ·php错误Fatal error: Out of memory (allocated 262144)(2013-12-04)
- ·Fatal error: Out of memory (allocated 786432)提示解决办法(2013-12-04)
- ·Fatal error: Maximum execution time of 30 错误(2013-12-04)
- ·Fatal Error: Allowed memory size of 123456789 bytes exhausted(2013-12-04)
- ·PHP 报错 Fatal error: Class 'COM' not found in(2013-12-05)
- ·PHP Fatal error: Cannot use object of type stdClass as array in错误(2014-09-20)
- ·php程序执行超时解决办法(Fatal error: Maximum execution time of 30)(2014-09-21)
- ·php提示Fatal error: Call to undefined function imagecreate()(2014-09-21)
- ·Fatal error: Allowed memory size of 134217728 bytes exhauste(2014-09-21)
- ·php Fatal error: Call to undefined function mb_convert_encoding()(2015-04-04)
- ·php提示Fatal error: Call to undefined function openssl_x509_parse()(2015-04-04)
- ·php使用ZipArchive提示Fatal error: Class ZipArchive not found in(2015-04-09)
- ·Fatal error: Access level to xxx must be protected 错误解决(2016-08-25)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)