Ejemplo n.º 1
0
function handleGetThumbnail($token, $imgpath)
{
    $owner = OC_Gallery_Sharing::getTokenOwner($token);
    $image = OC_Gallery_Photo::getThumbnail($imgpath, $owner);
    if ($image) {
        OCP\Response::enableCaching(3600 * 24);
        // 24 hour
        $image->show();
    }
}
Ejemplo n.º 2
0
 public static function createThumbnails($albumName, $files)
 {
     // create gallery thumbnail
     $file_count = min(count($files), 10);
     $thumbnail = imagecreatetruecolor($file_count * 200, 200);
     for ($i = 0; $i < $file_count; $i++) {
         $image = OC_Gallery_Photo::getThumbnail($files[$i]);
         if ($image && $image->valid()) {
             imagecopyresampled($thumbnail, $image->resource(), $i * 200, 0, 0, 0, 200, 200, 200, 200);
             $image->destroy();
         }
     }
     imagepng($thumbnail, OCP\Config::getSystemValue("datadirectory") . '/' . OCP\USER::getUser() . '/gallery/' . $albumName . '.png');
     imagedestroy($thumbnail);
 }
Ejemplo n.º 3
0
 public static function createThumbnails($albumName, $files)
 {
     // create gallery thumbnail
     $file_count = min(count($files), 10);
     $thumbnail = imagecreatetruecolor($file_count * 200, 200);
     for ($i = 0; $i < $file_count; $i++) {
         $image = OC_Gallery_Photo::getThumbnail($files[$i]);
         if ($image && $image->valid()) {
             imagecopyresampled($thumbnail, $image->resource(), $i * 200, 0, 0, 0, 200, 200, 200, 200);
             $image->destroy();
         }
     }
     $view = OCP\Files::getStorage('gallery');
     imagepng($thumbnail, $view->getLocalFile($albumName . '.png'));
     imagedestroy($thumbnail);
 }