diff options
author | shadlaws <shad@shadlaws.com> | 2013-01-30 01:07:36 +0100 |
---|---|---|
committer | shadlaws <shad@shadlaws.com> | 2013-01-30 01:07:36 +0100 |
commit | cf077425953a6a492dea97eaf1517e7d08c9648f (patch) | |
tree | 6754b984ff8ffad777050bfd8d1e3475189e4bbe /modules/gallery/helpers/item.php | |
parent | 861e8628f5d847cbf5bc3cc9f94254514e8296a8 (diff) |
#1968 - Improve album cover generation/removal/etc.
- Added stanza to Item_Model::save that handles when cover id is null.
- Added logic to graphics::generate to copy/convert album cover thumbs from their item thumbs to ensure they're always jpg, and eliminate the possibility that we copy/convert a dirty thumb.
- Redirected other places in code where we want to do one of the above two things to use these two functions instead (gallery_event::item_updated_data_file, item::make_album_cover, item::remove_album_cover).
- Improved validation in Item_Model so only albums can have covers and all covers must be non-albums.
- Added unit tests to Graphics_Helper_Test.
Diffstat (limited to 'modules/gallery/helpers/item.php')
-rw-r--r-- | modules/gallery/helpers/item.php | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 386eeb08..093feb2d 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -78,15 +78,9 @@ class item_Core { model_cache::clear(); $parent->album_cover_item_id = $item->is_album() ? $item->album_cover_item_id : $item->id; - 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) { @@ -97,15 +91,10 @@ class item_Core { static function remove_album_cover($album) { access::required("view", $album); access::required("edit", $album); - @unlink($album->thumb_path()); model_cache::clear(); $album->album_cover_item_id = null; - $album->thumb_width = 0; - $album->thumb_height = 0; - $album->thumb_dirty = 1; $album->save(); - graphics::generate($album); } /** |