While developing my applications which uses the imagick component to generate organograms.
This worked fine untill a few days ago. I'm sure nothing changed in the code!
We get this error:
Code: Select all
Fatal error: Uncaught exception 'ImagickException' with message 'Pixel cache allocation failed `'' in /var/www/ssi/classes/Draw/label.php:56 Stack trace: #0 /var/www/ssi/classes/Draw/label.php(56): Imagick->drawimage(Object(ImagickDraw))
It was driving me nuts and i thought that the problem was on the server (CentOS).
So i reinstalled the complete server (Ubuntu) an suprise suprise the same error.
That made me think it really must be the code... maybe somebody can help me out or give an alternative.
Here's the specific code:
Code: Select all
$labeltxt = new ImagickDraw();
$labeltxt->setFont(SITE_PATH_FONTS . $this->getFont());
$labeltxt->setFontSize($this->getFontsize());
$labeltxt->setFillColor($this->getFontcolor());
$labeltxt->annotation(0, $this->getFontsize()-3, $options["label"]);
if ($options["decoration"]) {
$labeltxt->setTextDecoration($options["decoration"]);
}
$metrics = $this->getImageobject()->queryFontMetrics($labeltxt, $options["label"]);
$labelw = ($options["options"]["width"]) ? r($options["options"]["width"]) : $metrics["textWidth"];
$labelh = $metrics["textHeight"]-3;
$this->getImageobject()->newImage($labelw, $labelh, "none");
$this->getImageobject()->drawImage($labeltxt);