Adldap\Models\User::getThumbnailEncoded PHP Method

getThumbnailEncoded() public method

Returns the users thumbnail photo base 64 encoded.
public getThumbnailEncoded ( ) : null | string
return null | string
    public function getThumbnailEncoded()
    {
        $thumb = $this->getThumbnail();
        return is_null($thumb) ? $thumb : 'data:image/jpeg;base64,' . base64_encode($thumb);
    }

Usage Example

Example #1
0
 /**
  * Handles retrieving the specified field from the User model.
  *
  * @param User   $user
  * @param string $field
  *
  * @return string|null
  */
 protected function handleAttributeRetrieval(User $user, $field)
 {
     if ($field === $this->getSchema()->thumbnail()) {
         // If the field we're retrieving is the users thumbnail photo, we need
         // to retrieve it encoded so we're able to save it to the database.
         $value = $user->getThumbnailEncoded();
     } else {
         $value = $user->{$field};
         // If the AD Value is an array, we'll
         // retrieve the first value.
         $value = is_array($value) ? array_get($value, 0) : $value;
     }
     return $value;
 }
All Usage Examples Of Adldap\Models\User::getThumbnailEncoded