Fatal error: function call undefined function imagefilter ()

What causes 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

This is the URL I'm using:

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

NOTE: gd is specified in the output of phpinfo ().

EDIT: I am using PHP Version 5.2.6-2ubuntu4.1

Another EDIT:

phpinfo () gives 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 

Thank!

0
source share
4 answers

What version of PHP are you using? Imagefilter seems to be a PHP5 function ... http://us3.php.net/manual/en/function.imagefilter.php

EDIT: Your code works with my version of PHP. For reference, here is 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 , . , , .

+2

imagefilter, -, , PHP GD-, ( ). Ubuntu, php, , GD.

+3

Just like the 2016 update, PHP 5.3 allowed the use of external GD, but for some reason this did not work in a clear / precise way. trusty, with PHP 5.5, has all of these image functions working except imageantialias, source https://bugs.launchpad.net/ubuntu/+source/php5/+bug/74647/comments/61 (and previous comments).

0
source

All Articles