diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-07-27 10:49:47 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-07-27 10:49:47 -0700 |
commit | 52f1c4b8c6a3a4043fcca3901a659b140b77f9d9 (patch) | |
tree | bb1b464aaae9852160f41d9b70c15026c4f9f833 /modules/gallery/helpers | |
parent | 2e52bcedcdf6962d51aade9273472d333e91a31a (diff) |
Don't invoke a graphics toolkit when setting the album cover from a
clean thumbnail; we can just copy it over. Should be a decent perf
improvement in many cases. Fixes ticket #1255.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/item.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 8fea49cc..092904a5 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -105,9 +105,15 @@ class item_Core { 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) { |