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.
This commit is contained in:
Bart Visscher 2012-02-08 21:09:47 +01:00
parent 43d2266f5c
commit 158360c09b
1 changed files with 5 additions and 2 deletions

View File

@ -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');
}