I've been a user of the Imagick PHP class for about 6 months now and i've implemented it in multiple Image altering functions across my project. Last week one of my functions, which simply equalizes the image using equalizeImage and then echo's the image out, stopped working. In all browsers it just returned a blank page, however when I echo'd out the image without a header('content-type: image/jpeg') it returned what looks to be the raw image. There were no errors displayed whatsoever (all my PHP errors are on) and I hadn't touched the code for the functions in weeks because it had been in use and working fine for that period of time. Since I'm using a MVC framework (cakePHP) I moved the function into another controller (another file) and tried to equalise the image again with the page returning blank. I managed to fix it eventually by moving the function into yet another file but I couldn't find the cause of the problem.
Today the same equalise function in the new file is producing this strange blank output again but to my dismay another function which echo's out a watermarked image to the page is doing the EXACT same thing (this function was working fine when the equalise function died the first time) I can't figure out whats causing the problem!
I have a variety of other functions which create thumbnails and then write them to directories on my server and these seem to work absolutely fine (for now) but when it comes to echoing out an image (not saving it anywhere) the output seems to be corrupt jpegs
This is simply the code for my function:
Code: Select all
$image = new Imagick($image_path);
$image->equalizeImage();
header('content-type: image/jpeg');
echo $image;
die();
Thanks in advance,
Jordan