Skip to content

Commit

Permalink
Don't invoke a graphics toolkit when setting the album cover from a
Browse files Browse the repository at this point in the history
clean thumbnail; we can just copy it over.  Should be a decent perf
improvement in many cases.  Fixes ticket #1255.
  • Loading branch information
bharat committed Jul 27, 2010
1 parent 2e52bce commit 52f1c4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/gallery/helpers/item.php
Expand Up @@ -105,9 +105,15 @@ static function make_album_cover($item) {

model_cache::clear();
$parent->album_cover_item_id = $item->is_album() ? $item->album_cover_item_id : $item->id;
$parent->thumb_dirty = 1;
if ($item->thumb_dirty) {
$parent->thumb_dirty = 1;
graphics::generate($parent);
} else {
copy($item->thumb_path(), $parent->thumb_path());
$parent->thumb_width = $item->thumb_width;
$parent->thumb_height = $item->thumb_height;
}
$parent->save();
graphics::generate($parent);
$grand_parent = $parent->parent();
if ($grand_parent && access::can("edit", $grand_parent) &&
$grand_parent->album_cover_item_id == null) {
Expand Down

0 comments on commit 52f1c4b

Please sign in to comment.