summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/graphics.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-04 23:20:54 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-04 23:20:54 -0700
commitc7f49fd1ec3ed7d2261b46e35d21d59a3af11f49 (patch)
treedf170d2954cd2e9ac5a74a658e7bd292056c6147 /modules/gallery/helpers/graphics.php
parent4f0a3fefa035ec351bc881093f49f9bc81941f3d (diff)
Skip over busted images when rebuilding. Change graphics::generate()
to return true/false on whether or not it could rebuild the image properly, then track the broke images in the task and ignore them. Fixes ticket #344.
Diffstat (limited to 'modules/gallery/helpers/graphics.php')
-rw-r--r--modules/gallery/helpers/graphics.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 605b9ff8..175ba947 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -102,11 +102,12 @@ class graphics_Core {
/**
* Rebuild the thumb and resize for the given item.
* @param Item_Model $item
+ * @return true on successful generation
*/
static function generate($item) {
if ($item->is_album()) {
if (!$cover = $item->album_cover()) {
- return;
+ return false;
}
$input_file = $cover->file_path();
$input_item = $cover;
@@ -123,7 +124,10 @@ class graphics_Core {
}
if (empty($ops)) {
- return;
+ $item->thumb_dirty = 0;
+ $item->resize_dirty = 0;
+ $item->save();
+ return true;
}
try {
@@ -167,7 +171,10 @@ class graphics_Core {
// @todo we should handle this better.
Kohana::log("error", "Caught exception rebuilding image: {$item->title}\n" .
$e->getTraceAsString());
+ return false;
}
+
+ return true;
}
/**