diff options
author | Chad Parry <github@chad.parry.org> | 2011-05-18 21:56:10 -0600 |
---|---|---|
committer | Chad Parry <github@chad.parry.org> | 2011-05-18 21:56:10 -0600 |
commit | f2336a5aaa0eb797f252388ecd7b93a82f9646fd (patch) | |
tree | 6686bcb18180db1fe04acb3f5e6d3871b1ec1c83 /modules | |
parent | e06b20738d0e0bdb80bae68b7fec2b3746192f6e (diff) |
Behave reasonably if the image cannot be resized.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gallery/helpers/graphics.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index acb11bfb..3b9769de 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -170,23 +170,37 @@ class graphics_Core { foreach (self::_get_rules($target) as $rule) { $args = array($working_file, $output_file, unserialize($rule->args), $item); - call_user_func_array($rule->operation, $args); - $working_file = $output_file; + try { + call_user_func_array($rule->operation, $args); + $working_file = $output_file; + } catch (Exception $e) { + // Ignore this filter and move on. + Kohana_Log::add("error", "Caught exception filtering image: {$item->title}\n" . + $e->getMessage() . "\n" . $e->getTraceAsString()); + } } } if (!empty($ops["thumb"])) { + if (file_exists($item->thumb_path())) { + $item->thumb_dirty = 0; + } else { + copy(MODPATH . "gallery/images/missing_photo.png", $item->thumb_path()); + } $dims = getimagesize($item->thumb_path()); $item->thumb_width = $dims[0]; $item->thumb_height = $dims[1]; - $item->thumb_dirty = 0; } if (!empty($ops["resize"])) { + if (file_exists($item->resize_path())) { + $item->resize_dirty = 0; + } else { + copy(MODPATH . "gallery/images/missing_photo.png", $item->resize_path()); + } $dims = getimagesize($item->resize_path()); $item->resize_width = $dims[0]; $item->resize_height = $dims[1]; - $item->resize_dirty = 0; } $item->save(); } catch (Exception $e) { |