Exemplo n.º 1
0
 /**
  * Stub - sends a generic avatar
  */
 public static function sendAvatar()
 {
     $uid = self::preDispatch(false);
     $image = new \OC_Image('iVBORw0KGgoAAAANSUhEUgAAADAAAAAwEAYAAAAHkiXEAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAwAAAAMADO7oxXAAAUWUlEQVR42u1beXBUVfb+3tZLOp21u0nSHbIRQkJYk5QwIhGNLMKAiDiCqGXpaKFSY2mpVTqOC9aUOo4zMjWihcoUboUysqqMDG6MJMAYooQtJJB962ydTi/v9Vt+f1zv73U3aQibOjOcKji5r1/fd9/3nXvuOefeBi7LZbksl+Wy/K8K81MP4GxiNptMDJOQkJ7ucDBMYaHdnprKsnl5RqPRCMTHGwyCAJjNoihJgM83MDA4qGnt7V1dbreq1tW53b29mnbypKZpGqCqP/X7RMvPhoC0NIeDZceNmznziisE4c47y8omTzaZFi9OS0tLS0kZPTo52WYrLJSklBSbLSuL4ywWszkxkec5ThAEgWWDwUBgcFCWvV6Px+1WlN5et7uhAejr6+k5cUJVGxoaGyWpsvKLL/buDQTWr6+pOXxYUbZulaRQCAgE/ucIyM/PyWHZq65atmzxYovlD38YP76oaMyYCRMmTy4t/dWvDAanMytr2jSeNxqNRosFAFS1vx/QNFUdGiLtYJD0JcuApgEsCzAMwxgMAMOwrNUKaJqmWa3A4GBfX309UFv73Xeffur319fX1X3+uap+8snnn3s8r7yyc+eXX4ZCL73k9wcCmjYw8F9HgNUaH88wdvvddy9bZrG8+eaVV/7iF+PHV1TMnFlR8fDDZnNycmpqbi6gabLc0kJ0aysB3OeL7EtVCbCKApA7w4nQtFCIXJckohWFkONwABwnCPn55F6bDTh2rLZ22zZJ2r9/37533/X716/fuNHjeeCBqqrqall+993/eALGjs3NZdmZMx966N57U1O3bJk1a968Rx+1WnNzx4y55hqe17RQqK4OUFVZ7ugg36GWzLKRfWkaAZh68nAChgNeksh1USS0iSLAMKGQJAEsqyhmM8B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9tbnQvb2dyZS9wcml2eS9kb2NzL2ljb25zL29wZW5faWNvbl9saWJyYXJ5LWRldmVsL2ljb25zL3RhbmdvL3N2ZzJwbmcvZW1vdGVzL2ZhY2Utc21pbGUtMi5zdmerBUU8AAAAAElFTkSuQmCC');
     \OC_Util::obEnd();
     echo $image->show();
 }
Exemplo n.º 2
0
	/**
	 * show preview
	 * @return void
	 */
	public function showPreview($mimeType = null) {
		\OCP\Response::enableCaching(3600 * 24); // 24 hours
		if (is_null($this->preview)) {
			$this->getPreview();
		}
		$this->preview->show($mimeType);
	}
Exemplo n.º 3
0
 /**
  * @brief show preview
  * @return void
  */
 public function showPreview()
 {
     \OCP\Response::enableCaching(3600 * 24);
     // 24 hours
     if (is_null($this->preview)) {
         $this->getPreview();
     }
     $this->preview->show('image/png');
     return;
 }
Exemplo n.º 4
0
function handleGetAlbumThumbnail($token, $albumname)
{
    $owner = OC_Gallery_Sharing::getTokenOwner($token);
    $file = OCP\Config::getSystemValue("datadirectory") . '/' . $owner . '/gallery/' . $albumname . '.png';
    $image = new OC_Image($file);
    if ($image->valid()) {
        $image->centerCrop();
        $image->resize(200);
        $image->fixOrientation();
        OCP\Response::enableCaching(3600 * 24);
        // 24 hour
        $image->show();
    }
}
Exemplo n.º 5
0
function handleGetAlbumThumbnail($token, $albumname)
{
    $owner = OC_Gallery_Sharing::getTokenOwner($token);
    $view = OCP\Files::getStorage('gallery');
    $file = $view->fopen($albumname . '.png', 'r');
    $image = new OC_Image($file);
    if ($image->valid()) {
        $image->centerCrop();
        $image->resize(200);
        $image->fixOrientation();
        OCP\Response::enableCaching(3600 * 24);
        // 24 hour
        $image->show();
    }
}
Exemplo n.º 6
0
 /**
  * @param null|string $mimeType
  * @throws NotFoundException
  */
 public function showPreview($mimeType = null)
 {
     // Check if file is valid
     if ($this->isFileValid() === false) {
         throw new NotFoundException('File not found.');
     }
     \OCP\Response::enableCaching(3600 * 24);
     // 24 hours
     if (is_null($this->preview)) {
         $this->getPreview();
     }
     if ($this->preview instanceof \OC_Image) {
         $this->preview->show($mimeType);
     }
 }
Exemplo n.º 7
0
            $img = $sharedGallery . '/' . $img;
        } else {
            $img = $sharedGallery;
        }
    } else {
        OC_JSON::error('no such file');
        die;
    }
}
$mime = $ownerView->getMimeType($img);
list($mimePart, ) = explode('/', $mime);
if ($mimePart === 'image') {
    $local = $ownerView->getLocalFile($img);
    $rotate = false;
    if (is_callable('exif_read_data')) {
        //don't use OC_Image here, using OC_Image will always cause parsing the image file
        $exif = @exif_read_data($local, 'IFD0');
        if (isset($exif['Orientation'])) {
            $rotate = $exif['Orientation'] > 1;
        }
    }
    if ($rotate) {
        $image = new OC_Image($local);
        $image->fixOrientation();
        $image->show();
    } else {
        //use the original file if we dont need to rotate, saves having to re-encode the image
        header('Content-Type: ' . $mime);
        $ownerView->readfile($img);
    }
}
Exemplo n.º 8
0
    OCP\Util::writeLog('contacts', 'thumbnail.php. The VCard for ID ' . $id . ' is not RFC compatible', OCP\Util::ERROR);
    getStandardImage();
    exit;
}
OCP\Response::enableCaching($caching);
OC_Contacts_App::setLastModifiedHeader($contact);
$thumbnail_size = 23;
// Find the photo from VCard.
$image = new OC_Image();
$photo = $contact->getAsString('PHOTO');
if ($photo) {
    OCP\Response::setETagHeader(md5($photo));
    if ($image->loadFromBase64($photo)) {
        if ($image->centerCrop()) {
            if ($image->resize($thumbnail_size)) {
                if ($image->show()) {
                    // done
                    exit;
                } else {
                    OCP\Util::writeLog('contacts', 'thumbnail.php. Couldn\'t display thumbnail for ID ' . $id, OCP\Util::ERROR);
                }
            } else {
                OCP\Util::writeLog('contacts', 'thumbnail.php. Couldn\'t resize thumbnail for ID ' . $id, OCP\Util::ERROR);
            }
        } else {
            OCP\Util::writeLog('contacts', 'thumbnail.php. Couldn\'t crop thumbnail for ID ' . $id, OCP\Util::ERROR);
        }
    } else {
        OCP\Util::writeLog('contacts', 'thumbnail.php. Couldn\'t load image string for ID ' . $id, OCP\Util::ERROR);
    }
}
Exemplo n.º 9
0
 public static function getTmpAvatar($args)
 {
     \OC_JSON::checkLoggedIn();
     \OC_JSON::callCheck();
     $tmpavatar = \OC_Cache::get('tmpavatar');
     if (is_null($tmpavatar)) {
         $l = new \OC_L10n('core');
         \OC_JSON::error(array("data" => array("message" => $l->t("No temporary profile picture available, try again"))));
         return;
     }
     $image = new \OC_Image($tmpavatar);
     \OC_Response::disableCaching();
     \OC_Response::setLastModifiedHeader(time());
     \OC_Response::setETagHeader(crc32($image->data()));
     $image->show();
 }