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(); } }
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); }
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); }