예제 #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 resolveLighten()
 {
     $color = new Color($this->options['group']);
     $this->font = $color->lighten(30, 'Rgb');
 }
예제 #3
0
 private function init()
 {
     $this->ivatar = new \Imagick();
     $base = new Color($this->options['group']);
     $this->ivatar->newImage($this->options['size'], $this->options['size'], new \ImagickPixel($base->getHex()), 'jpg');
 }