summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/gallery_event.php
diff options
context:
space:
mode:
authorshadlaws <shad@shadlaws.com>2013-01-30 01:07:36 +0100
committershadlaws <shad@shadlaws.com>2013-01-30 01:07:36 +0100
commitcf077425953a6a492dea97eaf1517e7d08c9648f (patch)
tree6754b984ff8ffad777050bfd8d1e3475189e4bbe /modules/gallery/helpers/gallery_event.php
parent861e8628f5d847cbf5bc3cc9f94254514e8296a8 (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/gallery_event.php')
-rw-r--r--modules/gallery/helpers/gallery_event.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index bd9acc1c..ee3c51cc 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -141,10 +141,9 @@ class gallery_event_Core {
foreach (ORM::factory("item")
->where("album_cover_item_id", "=", $item->id)
->find_all() as $target) {
- copy($item->thumb_path(), $target->thumb_path());
- $target->thumb_width = $item->thumb_width;
- $target->thumb_height = $item->thumb_height;
+ $target->thumb_dirty = 1;
$target->save();
+ graphics::generate($target);
}
}