mkoppanen/imagick — pull request #28 by Danack (2014-05-09 18:17:27+00:00)
Title: Progress monitor will user callback

Hi,

Attached is an apparently working version of MagickSetImageProgressMonitor with a user defined callback. It can be used with:

```
$callback = function ($offset, $span) use ($startTime) {
if (time() - $startTime > 5) {
echo "Image is taking too long to process.";
return false;
}
return true;
};

try {
$imagick = new \Imagick(realpath($this->imagePath));
$imagick->setProgressMonitor($callback);

$imagick->waveImage(8, 25);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
catch(\ImagickException $e) {
echo "ImagickException caught: ".$e->getMessage()." Exception type is ".get_class($e);
}

```

It doesn't seem to give any error in valgrind however you may want to check the code carefully as:

![I have no idea](http://www.basereality.com/image/2395/300/97VP.jpeg)

Seriously, this is my first attempt to use TSRMLS, so I would not be surprised if i've misunderstood something.