/** * Action to serve an error image */ public function error_on_image() { $err = intval($this->EE->input->get('err')); if ($err > 0 && $this->EE->config->item('wda_img_debug') == 'y' && isset($this->errors[$err])) { $width = intval($this->EE->input->get('w')); $height = intval($this->EE->input->get('h')); if ($width == 0) { $width = 100; } if ($height == 0) { $height = 100; } $error_string = $this->errors[$err]; $img = new \PHPImageWorkshop\ImageWorkshop(array('width' => $width, 'height' => $height)); $textLayer = new \PHPImageWorkshop\ImageWorkshop(array("text" => $error_string, "fontSize" => 22, "fontColor" => "000000", "width" => $width, "height" => $height)); $img->addLayer(1, $textLayer, 10, 10, 'LB'); $image = $img->getResult(); header('Content-type: image/jpeg'); imagejpeg($image, null, 95); } }