Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2007
    Posts
    217
    Thanks
    25
    Thanked 1 Time in 1 Post

    Warning: imagefilter() expects parameter 2 to be long, string given

    I'm using this code to put a filter on an image:

    $filter="pixelate";
    if ($filter == 'negative')
    imagefilter($img,IMG_FILTER_NEGATE);
    else
    if ($filter == 'grayscale')
    imagefilter($img,IMG_FILTER_GRAYSCALE);
    else
    if ($filter == 'brightness')
    imagefilter($img,IMG_FILTER_BRIGHTNESS, $_REQUEST['arg1']);
    else
    if ($filter == 'contrast')
    imagefilter($img,IMG_FILTER_CONTRAST, $_REQUEST['arg1']);
    else
    if ($filter == 'colorize')
    imagefilter($img,IMG_FILTER_COLORIZE, $_REQUEST['arg1'], $_REQUEST['arg2'], $_REQUEST['arg3']);
    else
    if ($filter == 'edgedetect')
    imagefilter($img,IMG_FILTER_EDGEDETECT);
    else
    if ($filter == 'emboss')
    imagefilter($img,IMG_FILTER_EMBOSS);
    else
    if ($filter == 'gaussian_blur')
    imagefilter($img,IMG_FILTER_GAUSSIAN_BLUR);
    else
    if ($filter == 'selective_blur')
    imagefilter($img,IMG_FILTER_SELECTIVE_BLUR);
    else
    if ($filter == 'mean_removal')
    imagefilter($img,IMG_FILTER_MEAN_REMOVAL);
    else
    if ($filter == 'pixelate')
    imagefilter($img, IMG_FILTER_PIXELATE, 3, true);
    else
    if ($filter == 'smooth')
    imagefilter($img,IMG_FILTER_SMOOTH, $_REQUEST['arg1']);
    imagepng($img);
    imagedestroy($img);
    They all work fine, except the pixelate function, it's giving me:
    Warning: imagefilter() expects parameter 2 to be long, string given
    How can I alter the coding so that it will work?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,858
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Which is your PHP version? Have you checked the "Changelog" at http://php.net/imagefilter
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Feb 2007
    Posts
    217
    Thanks
    25
    Thanked 1 Time in 1 Post
    :S I've got version 5.2

    Thanks for replying

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    You may have missed what abduraooft was indicating:
    Changelog
    Version Description
    5.3.0 Pixelation support (IMG_FILTER_PIXELATE) was added.
    5.2.5 Alpha support for IMG_FILTER_COLORIZE was added.
    IMG_FILTER_PIXELATE is not available for you to use, and IMG_FILTER_COLORIZE *may* be available depending on your revision (you only have 5.2 here, you need 5.2.5 to use IMG_FILTER_COLORIZE).
    Since none of these exist, PHP's default fallback on undefined constants is to treat them as strings. This is why you are getting the error; IMG_FILTER_PIXELATE is interpreted as 'IMG_FILTER_PIXELATE' instead of as its intended integer value.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •