Skip to content
This repository has been archived by the owner on Nov 14, 2018. It is now read-only.

Commit

Permalink
new thumbnail style for galleries
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Oct 28, 2012
1 parent c8d5486 commit 33a389f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gallery/lib/thumbnail.php
Expand Up @@ -81,12 +81,20 @@ public function create($albumPath, $square = false) {
$images = \OC_Filecache::searchByMime('image', null, '/' . $user . '/files' . $albumPath);

$count = min(count($images), 10);
$thumbnail = imagecreatetruecolor($count * 200, 200);
$thumbnail = imagecreatetruecolor(200, 200);
imagesavealpha($thumbnail, true);
imagefill($thumbnail, 0, 0, 0x7fff0000);
imagealphablending($thumbnail, true);
for ($i = 0; $i < $count; $i++) {
$thumb = new Thumbnail($albumPath . '/' . $images[$i], true);
$thumb = new Thumbnail($albumPath . '/' . $images[$i]);
$image = $thumb->get();
$image->fitIn(80, 80);
if ($image && $image->valid()) {
imagecopy($thumbnail, $image->resource(), $i * 200, 0, 0, 0, 200, 200);
$h = $image->height();
$w = $image->width();
$x = (($i % 2) * 100) + (100 - $w) / 2;
$y = (floor($i / 2) * 100) + (100 - $h) / 2;
imagecopy($thumbnail, $image->resource(), $x, $y, 0, 0, $w, $h);
$image->destroy();
}
}
Expand Down

0 comments on commit 33a389f

Please sign in to comment.