From 0389dceb475597ecdedf519d27d6d7bb36aa6276 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 10 Jul 2010 21:29:34 -0700 Subject: Rotate all matching album covers when we rotate an item. Fixes ticket #1200. --- modules/gallery/controllers/quick.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'modules') diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index 08a33138..dc0c380a 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -46,13 +46,14 @@ class Quick_Controller extends Controller { graphics::generate($item); - $parent = $item->parent(); - // @todo: this is an inadequate way to regenerate the parent's thumbnail after rotation. - if ($parent->album_cover_item_id == $item->id) { - copy($item->thumb_path(), $parent->thumb_path()); - $parent->thumb_width = $item->thumb_width; - $parent->thumb_height = $item->thumb_height; - $parent->save(); + // @todo: this is an inadequate way to regenerate album cover thumbnails after rotation. + 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(); } } -- cgit v1.2.3