dongmi6102
2014-04-11 02:14
浏览 645
已采纳

PHP致命错误:找不到类'imagecreatefromjpeg'

I'm trying to create thumbnails for some images. In order to do this I'd like to use the function imagecreatefromjpeg available in the php-gd class (I'm using this function because I found some code on the web that seemed pretty straight forward). However I'm getting the error:

PHP Fatal error: Class 'imagecreatefromjpeg' not found

I've checked that the GD Class is installed and available, and it is:

gd
GD Support  enabled
GD Version  bundled (2.0.34 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.3.11
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version     6b
PNG Support     enabled
libPNG Version  1.2.49
WBMP Support    enabled
XPM Support     enabled
XBM Support     enabled 

I've also read that I needed the php-gd packaged installed in my CentOS server, which I it is:

php-gd.x86_64                   5.3.3-23.el6_4

I did a quick search for the jpeg library and found:

/usr/lib64/libjpeg.so.62

I also read that I needed to include this library in the php.ini, which I also did:

--with-jpeg-dir=/usr/lib64

My questions:

  • How can I validate that the gd library is actually configured and accessible?
  • Is there anything else missing from my configuration?

Current PHP Version: 5.3.3-23.el6_4

图片转代码服务由CSDN问答提供 功能建议

我正在尝试为某些图像创建缩略图。 为了做到这一点,我想使用php-gd类中提供的函数imagecreatefromjpeg(我正在使用这个函数,因为我在网上发现了一些看似非常简单的代码)。 但是我收到了错误:</ p>

  PHP致命错误:未找到类'imagecreatefromjpeg'
 </ code> </ pre> 
 
 

I 已检查GD类已安装且可用,它是:</ p>

  gd 
GD支持已启用
捆绑的nGD版本(2.0.34兼容)
FreeType支持已启用\  nFreeType链接与freetype 
FreeType版本2.3.11 
GIF读取支持已启用
GIF创建支持已启用
JPEG支持已启用
libJPEG版本6b 
PNG支持已启用
libPNG版本1.2.49 
启用了nWBMP支持
XPM支持已启用
XBM支持已启用 
 </ code> </ pre> 
 
 

我还读到我需要在我的CentOS服务器中安装php-gd打包,我就是这样:</ p> < pre> php-gd.x86_64 5.3.3-23.el6_4 </ code> </ pre>

我快速搜索了jpeg库并找到了:</ p>

  /usr/lib64/libjpeg.so.62
 </ code> </ pre> 
 
 

我还读到我需要在php中包含这个库 .ini,我也是 做了:</ p>

   -  with-jpeg-dir = / usr / lib64 
 </ code> </ pre> 
 
 

我的问题:</ p>

  • 如何验证gd库是否已实际配置并可访问?</ li>
  • 我的配置中是否还有其他内容缺失?</ li> </ ul>

    当前PHP版本:5.3.3-23.el6_4 </ p> </ div>

1条回答 默认 最新

相关推荐 更多相似问题