示例#1
0
 private function background()
 {
     $base = new Color($this->options['group']);
     $background = $base->getRgb();
     $background = imagecolorallocate($this->ivatar, $background['r'], $background['g'], $background['b']);
     imagefill($this->ivatar, 0, 0, $background);
     if ($this->config['method'] === 'image' && is_file($this->config['image'])) {
         $info = getimagesize($this->config['image']);
         switch ($info[2]) {
             case IMAGETYPE_JPEG:
                 $image = imagecreatefromjpeg($this->config['image']);
                 break;
             case IMAGETYPE_PNG:
                 $image = imagecreatefrompng($this->config['image']);
                 break;
             case IMAGETYPE_GIF:
                 $image = imagecreatefromgif($this->config['image']);
                 break;
             default:
                 throw new Exception\NotSupportedException("Ivatar - ({$this->config['image']}) must be of type JPEG, PNG, or GIF.");
         }
         $prop = $info[0] / ($info[1] / $this->options['size']);
         imagecopyresampled($this->ivatar, $image, 0, 0, ($prop - $this->options['size']) / 2, 0, $prop, $this->options['size'], $info[0], $info[1]);
     }
 }
示例#2
0
 public function resolveStandard()
 {
     $color = new Color($this->config['default']['font']);
     $this->font = $color->getRgb();
 }