Forum Moderators: coopster
I'm trying to build a little function that would take a full-color image and turn it into a grayscale image. Looking at the php manual makes this look very simple - now I'm not so sure.
When I run the script, I don't get any errors (as I'm use to seeing errors, anyway) but what I do get is a half-page of garbage symbols (i.e. ÿØÿà�JFIF������ÿþ�>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛ�C� $.' ",#(7)... and so on).
Here's my function and it's caller. What am I missing?
Neophyte
**********************
function imageGray($fileDir, $fileName)
{
$fullPath = $fileDir . '/' . $fileName;
$im = imagecreatefromjpeg($fullPath);
imagefilter($im, IMG_FILTER_GRAYSCALE);
imagejpeg($im);
imagedestroy($im);
}
$fileDir = 'thumb';
$fileName = 'alanhead.jpg';
imageGray($fileDir, $fileName);