Esempio n. 1
0
 /**
  * @return ErrorDrawer
  **/
 public function draw($string = 'ERROR!')
 {
     if (!ErrorDrawer::isDrawError()) {
         return $this;
     }
     $y = round($this->turingImage->getHeight() / 2 - imagefontheight(ErrorDrawer::FONT_SIZE) / 2);
     $textWidth = imagefontwidth(ErrorDrawer::FONT_SIZE) * strlen($string);
     if ($this->turingImage->getWidth() > $textWidth) {
         $x = round(($this->turingImage->getWidth() - $textWidth) / 2);
     } else {
         $x = 0;
     }
     $color = $this->turingImage->getOneCharacterColor();
     imagestring($this->turingImage->getImageId(), ErrorDrawer::FONT_SIZE, $x, $y, $string, $color);
     return $this;
 }
Esempio n. 2
0
 /**
  * @return TextDrawer
  **/
 protected function showError()
 {
     $drawer = new ErrorDrawer($this->getTuringImage());
     $drawer->draw();
     return $this;
 }