Esempio n. 1
0
$height = 122;
$font = "/usr/share/fonts/liberation/LiberationSerif-Bold.ttf";
$png = ImageCreate($width, $height);
$white = ImageColorAllocate($png, 255, 255, 255);
$black = ImageColorAllocate($png, 0, 0, 0);
$green = ImageColorAllocate($png, 0, 255, 0);
$blue = ImageColorAllocate($png, 0, 0, 255);
$red = ImageColorAllocate($png, 255, 0, 0);
$grey = ImageColorAllocate($png, 220, 220, 220);
/* Draw the box! */
$margin_left = 40;
$margin_right = 4;
$margin_top = 40;
$margin_bottom = 4;
ImageRectangleWithRoundedCorners($png, $margin_left, $margin_top, $width - $margin_right, $height - $margin_bottom, 10, $black);
ImageRectangleWithRoundedCorners($png, $margin_left + 4, $margin_top + 4, $width - $margin_right - 4, $height - $margin_bottom - 4, 10, $white);
$boxcenterx = $margin_left + ($width - $margin_right - $margin_left) / 2;
$boxcentery = $margin_top + ($height - $margin_top - $margin_bottom) / 2;
$boxwidth = $width - $margin_left - $margin_right;
$boxheight = $height - $margin_top - $margin_bottom;
ImageLine($png, $boxcenterx, $margin_top, $boxcenterx, $height - $margin_bottom, $black);
ImageLine($png, $margin_left, $boxcentery, $width - $margin_right, $boxcentery, $black);
ImageTTFText($png, 12, 90, 14, $height - 2, $blue, $font, "Observation");
ImageTTFText($png, 14, 0, 25, $boxcentery - 10, $black, $font, "Y");
ImageTTFText($png, 14, 0, 25, $boxcentery + 25, $black, $font, "N");
ImageTTFText($png, 12, 0, $width - 75, 14, $red, $font, "Warning");
ImageTTFText($png, 14, 0, $boxcenterx - 20, 34, $black, $font, "Y");
ImageTTFText($png, 14, 0, $boxcenterx + 10, 34, $black, $font, "N");
/* Now we get fancy! */
ImageTTFTextAlign($png, 28, 0, $boxcenterx - $boxwidth / 4, $boxcentery - 2, $grey, $font, "A", "C");
ImageTTFTextAlign($png, 28, 0, $boxcenterx + $boxwidth / 4, $boxcentery - 2, $grey, $font, "B", 'C');
Esempio n. 2
0
 public function fillBorder($color = false, $mm = 2)
 {
     $mm = is_int($mm) && $mm > 2 && $mm < 6 ? $mm : 2;
     $wr = 5 + $mm * 1.67;
     if (is_bool($color)) {
         return false;
     }
     if (!is_array($color)) {
         $color = $this->colors['black'];
     }
     $w = round($this->imageParams['w'] * $this->multiplier[$this->selectedMultiplier]);
     $h = round($this->imageParams['h'] * $this->multiplier[$this->selectedMultiplier]);
     $img = imagecreatetruecolor($w, $h);
     $color = imagecolorallocate($img, $color['r'], $color['g'], $color['b']);
     $black = imagecolorallocate($img, 0, 0, 0);
     $transparent = imagecolorallocate($img, 21, 83, 64);
     imagefilledrectangle($img, 0, 0, $w, $h, $transparent);
     ImageRectangleWithRoundedCorners($img, 5, 5, $w - 5, $h - 5, 12, $color);
     ImageRectangleWithRoundedCorners($img, $wr, $wr, $w - $wr, $h - $wr, 12, $transparent);
     imagecolortransparent($img, $transparent);
     imagecopyresized($this->image, $img, 0, 0, 0, 0, imagesx($this->image), imagesy($this->image), imagesx($img), imagesy($img));
     imagedestroy($img);
 }