Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getBase64($format = 'png')
 {
     $this->create($this->width, $this->height);
     $code = $this->newCode($this->chars, $this->length);
     $this->addFilters(array(new Background($this->backgroundColor), new Border($this->borderColor), new Strip($this->fontColor), new Text($code, $this->fontSize, $this->fonts, $this->fontColor)));
     if ($this->grayscale) {
         $this->addFilter(new GrayScale());
     }
     return parent::getBase64($format);
 }
Ejemplo n.º 2
0
 public function testCreateResource()
 {
     $gd = new Gd();
     $gd->create(100, 100);
     try {
         $gd->checkResource();
     } catch (\Exception $e) {
         $this->fail('Resource does not create.');
     }
     $this->assertEquals(100, $gd->getWidth());
     $this->assertEquals(100, $gd->getHeight());
     $this->assertEquals('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAANElEQVR4nO3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfgx1lAABqFDyOQAAAABJRU5ErkJggg==', $gd->getBase64());
 }