Skip to content

Commit

Permalink
Rotate all matching album covers when we rotate an item. Fixes ticket…
Browse files Browse the repository at this point in the history
… #1200.
  • Loading branch information
bharat committed Jul 11, 2010
1 parent eb19192 commit 0389dce
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions modules/gallery/controllers/quick.php
Expand Up @@ -46,13 +46,14 @@ public function rotate($id, $dir) {

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();
}
}

Expand Down

0 comments on commit 0389dce

Please sign in to comment.