From 158360c09b2f14b676daf3091c5743fd2a50748a Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Wed, 8 Feb 2012 21:09:47 +0100 Subject: [PATCH] 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. --- apps/gallery/lib/scanner.php | 7 +++++-- 1 file 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'); } -- 2.39.5