diff options
Diffstat (limited to 'apps/gallery/lib/managers.php')
-rw-r--r-- | apps/gallery/lib/managers.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/apps/gallery/lib/managers.php b/apps/gallery/lib/managers.php index 3b6f754fc2d..b6ade3d1b1e 100644 --- a/apps/gallery/lib/managers.php +++ b/apps/gallery/lib/managers.php @@ -71,9 +71,9 @@ class ThumbnailsManager { } public function getThumbnail($path) { - $gallery_path = \OCP\Config::getSystemValue( 'datadirectory' ).'/'.\OC_User::getUser().'/gallery'; - if (file_exists($gallery_path.$path)) { - return new \OC_Image($gallery_path.$path); + $gallery_storage = \OCP\Files::getStorage('gallery'); + if ($gallery_storage->file_exists($path)) { + return new \OC_Image($gallery_storage->getLocalFile($path)); } if (!\OC_Filesystem::file_exists($path)) { \OC_Log::write(self::TAG, 'File '.$path.' don\'t exists', \OC_Log::WARN); @@ -92,8 +92,9 @@ class ThumbnailsManager { unset($image); return false; } + $l = $gallery_storage->getLocalFile($path); - $image->save($gallery_path.'/'.$path); + $image->save($l); return $image; } @@ -122,9 +123,9 @@ class ThumbnailsManager { } public function delete($path) { - $thumbnail = \OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser()."/gallery".$path; - if (file_exists($thumbnail)) { - unlink($thumbnail); + $thumbnail_storage = \OCP\Files::getStorage('gallery'); + if ($thumbnail_storage->file_exists($path)) { + $thumbnail_storage->unlink($path); } } |