Ejemplo n.º 1
0
 /**
  * Resize and rotate the image if needed.
  */
 private function normalizePhoto()
 {
     if ($this->normalized) {
         return;
     }
     $this->image->fixOrientation();
     if ($this->image->height() > self::MAX_SIZE || $this->image->width() > self::MAX_SIZE) {
         $this->image->resize(self::MAX_SIZE);
     }
     $this->normalized = true;
 }
Ejemplo n.º 2
0
 /**
  * Get contact photo
  */
 public function getPhoto($size = 40)
 {
     if (!isset($this->vcard->PHOTO)) {
         return false;
     } else {
         $image = new Image(base64_encode((string) $this->vcard->PHOTO));
         $image->resize($size);
         return 'data:' . $image->mimeType() . ';base64,' . $image->__toString();
     }
 }