diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-08-07 22:18:28 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-08-07 22:18:28 -0700 |
commit | dfb095a26267f8b68b40add03dfe407966c49b92 (patch) | |
tree | 3306c1bc1fd33fc888270b1c312771baed3b4aed /modules/gallery/helpers/gallery_event.php | |
parent | 1abf43d3f1efa9d0d51f4c7e8f6f946db2497a09 (diff) |
Add the ability to replace the source data file in Item_Model::save().
Refactor the rotate code in Quick_Controller to replace the data file,
and then have gallery_event::item_updated_data_file() pick up after
the change is saved, rebuild the image and handle album covers. This
is much more portable than before and it will allow any mechanism (eg:
REST) to replace the source image.
Diffstat (limited to 'modules/gallery/helpers/gallery_event.php')
-rw-r--r-- | modules/gallery/helpers/gallery_event.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index e3fa5e08..e048118b 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -124,6 +124,20 @@ class gallery_event_Core { } } + static function item_updated_data_file($item) { + graphics::generate($item); + + // Update any places where this is the album cover + 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->save(); + } + } + static function batch_complete() { // Set the album covers for any items that where we probably deleted the album cover during // this batch. The item may have been deleted, so don't count on it being around. Choose the |