Beispiel #1
0
 /**
  * Get the identicon for a model. This function will overwrite the previous avatar
  *
  * @param string $idData The data (name or id) that will be used to generate an identicon
  *
  * @return string The path to the generated identicon
  */
 protected function getIdenticon($idData)
 {
     Service::getContainer()->get('logger')->info('Generating new identicon for "' . $this->getName() . '" in ' . $this->getAvatarPath());
     $identicon = new Identicon();
     $imageData = $identicon->getImageData($idData, 250);
     $path = $this->getAvatarPath($imageData);
     file_put_contents(DOC_ROOT . $path, $imageData);
     return $path;
 }
 /**
  * Get the image data
  * @param   $string
  * @param   $size
  * @param   $color
  * @return
  */
 public function getImageData($string, $size = 64, $color = null)
 {
     return $this->identicon->getImageData($string, $size, $color);
 }