diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-02-08 21:09:47 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-02-08 21:12:31 +0100 |
commit | 158360c09b2f14b676daf3091c5743fd2a50748a (patch) | |
tree | de06e7f2ed88ca28fc02130b99ba11827cde1b9d | |
parent | 43d2266f5ca9f9f2802bf131fddeb21f849f3d12 (diff) | |
download | nextcloud-server-158360c09b2f14b676daf3091c5743fd2a50748a.tar.gz nextcloud-server-158360c09b2f14b676daf3091c5743fd2a50748a.zip |
Gallery: use thumbnails of images for the album thumbnail
The thumbnails were already generated in this function, but now we save them
for displaying of the album.
-rw-r--r-- | apps/gallery/lib/scanner.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index 3aae94d1a4f..9fdadbe38c7 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -89,8 +89,11 @@ class OC_Gallery_Scanner { $file_count = min(count($files), 10); $thumbnail = imagecreatetruecolor($file_count*200, 200); for ($i = 0; $i < $file_count; $i++) { - $imagePath = OC_Filesystem::getLocalFile($files[$i]); - CroppedThumbnail($imagePath, 200, 200, $thumbnail, $i*200); + $image = OC_Gallery_Photo::getThumbnail($files[$i]); + if ($image && $image->valid()) { + imagecopyresampled($thumbnail, $image->resource(), $i*200, 0, 0, 0, 200, 200, 200, 200); + } + unset($image); // unset $image here to control the lifetime of image::$resource } imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/' . $albumName.'.png'); } |