是什么导致了这个错误?
致命错误:在第 5 行的 /var/www/polaroid.php 中调用未定义的函数 imagefilter()
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() 的输出中。
编辑:我正在使用 PHP 版本 5.2.6-2ubuntu4.1
另一个编辑:
phpinfo() 在 gd 部分产生这个
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
谢谢!