summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-02-15 00:57:19 +0000
committerBharat Mediratta <bharat@menalto.com>2009-02-15 00:57:19 +0000
commitd8049cf711ffe9b6b7f531ea77dac23b86066516 (patch)
tree22f512a5981fc53681e9abe0cfbac413fb435787
parent9e08285c003de4fcb2dad9bd6917c326961ed524 (diff)
Album cover fixes. Don't bomb in generate if we can't load the album
cover (it might be deleted and we forgot to update the album_cover_item_id column). Also, exclude albums with missing album_cover_item_id's from the dirty query.
-rw-r--r--core/helpers/graphics.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php
index 4292bcbb..4ec21ee8 100644
--- a/core/helpers/graphics.php
+++ b/core/helpers/graphics.php
@@ -83,7 +83,11 @@ class graphics_Core {
*/
static function generate($item) {
if ($item->is_album()) {
- $cover = $item->album_cover();
+ try {
+ $cover = $item->album_cover();
+ } catch (Exception $e) {
+ return;
+ }
if (!$cover) {
return;
}
@@ -217,7 +221,7 @@ class graphics_Core {
static function find_dirty_images_query() {
return Database::instance()->query(
"SELECT `id` FROM `items` " .
- "WHERE (`thumb_dirty` = 1 AND (`type` <> 'album' OR `right` - `left` > 1))" .
+ "WHERE (`thumb_dirty` = 1 AND (`type` <> 'album' OR `album_cover_item_id` IS NOT NULL))" .
" OR (`resize_dirty` = 1 AND `type` = 'photo')");
}