Reputation: 6063
I have writen a small script to go in a Facebook App that can filter images for you. I am having trouble with the GRAYSCALE filter It seems to only display what I think is byte code for the image, instead of the image. I think this may have something to do with the headers and content type. I need to display the image filtered by PHP with this code:
header("content-type: image/jpeg");
$image = imagecreatefromjpeg("http://majik.zbrowntechnology.info/upload/zbt_1794056140.jpg");
imagefilter($image, IMG_FILTER_GRAYSCALE);
imagepng($image);
imagedestroy($image, 'test.jpg');
on an HTML page. Any ideas?
Upvotes: 0
Views: 568
Reputation: 117334
The script works fine for me, I see the grayscaled image(even with the wrong parts listed above)
If you see there the source I would guess at first, that there is any output before the headers can be sent. Set error_reporting to E_ALL, so you can see if and where there is some unintended output.
Upvotes: 0
Reputation: 3474
You set Content-Type to image/jpeg but send a PNG image.
header("Content-Type: image/jpeg");
imagejpeg($image);
This should work.
BTW: imagedestroy()
only has one argument
Upvotes: 1