致命错误:调用未定义的函数imagefilter() [英] Fatal error: Call to undefined function imagefilter()

查看:576
本文介绍了致命错误:调用未定义的函数imagefilter()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导致此错误的原因是什么?

What is causing this error?


Fatal error: Call to undefined function imagefilter() in /var/www/polaroid.php on line 5



  1 <?PHP
  2   $img_addr = $_GET['image_address'];
  3   $img = imagecreatefromjpeg($img_addr);
  4
      /* everything works as expected without this line */
  5   imagefilter($img, IMG_FILTER_GRAYSCALE);  
  6
  7   if ($img)
  8   {
        /* I moved the header function here so I can see errors in the browser. 
           If I leave it at the top of the file, the browser expects an image 
           and doesn't print the error messages. */
  9     header('Content-type: image/jpeg');
 10     imagejpeg($img);
 11   }
 12 ?>
 13

这是我使用的网址:


http://localhost/polaroid.php?image_address=http://mattnelsoninfo.files.wordpress.com/2008/04/ceiling_cat1.jpg

注意:gd列在phpinfo()的输出中。

NOTE: gd is listed in the output from phpinfo().

phpinfo()在gd部分得出这个结果

phpinfo() yields this in the gd section

gd
GD Support  enabled
GD Version  2.0 or higher
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.3.7
T1Lib Support   enabled
GIF Read Support    enabled
GIF Create Support  enabled
JPG Support     enabled
PNG Support     enabled
WBMP Support    enabled 

谢谢!

推荐答案

您使用的是哪个版本的PHP?看起来imagefilter是一个PHP5函数... http://us3.php .net / manual / en / function.imagefilter.php

What version of PHP are you using? It looks like imagefilter is a PHP5 function ... http://us3.php.net/manual/en/function.imagefilter.php

编辑:
您的代码适用于我的PHP版本。作为参考,这是我的phpinfo:

Your code works on my version of PHP. For reference, here's my phpinfo:

gd
GD Support  enabled
**GD Version    bundled (2.0.34 compatible)**
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.1.9
T1Lib Support   enabled
GIF Read Support    enabled
GIF Create Support  enabled
JPG Support     enabled
PNG Support     enabled
WBMP Support    enabled
XBM Support     enabled

您可能希望确保捆绑了GD版本。我见过安装说GD支持已启用但未捆绑。不确定这是否会产生影响。

You might want to make sure that the GD Version is bundled. I've seen installations that say GD Support is enabled but not bundled. Not sure if that makes a difference though.

这篇关于致命错误:调用未定义的函数imagefilter()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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