diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-06-07 17:48:42 -0700 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-06-07 17:48:42 -0700 |
| commit | c7aafef85279114a8ae8855647394bb26400b3de (patch) | |
| tree | 5bb9220fce9901e46e15f5609420a312e4f097a4 /modules/gallery/helpers | |
| parent | b179b106c2b4d3971498f513ffc71eff1b6b1a5d (diff) | |
Improve error handling support for corrupt images and report them
appropriately in g2_import.
Diffstat (limited to 'modules/gallery/helpers')
| -rw-r--r-- | modules/gallery/helpers/graphics.php | 7 | ||||
| -rw-r--r-- | modules/gallery/helpers/photo.php | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 4846fa8a..25eb0891 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -166,12 +166,11 @@ class graphics_Core { $item->resize_dirty = 0; } $item->save(); - } catch (Kohana_Exception $e) { + } catch (Exception $e) { // Something went wrong rebuilding the image. Leave it dirty and move on. // @todo we should handle this better. Kohana::log("error", "Caught exception rebuilding image: {$item->title}\n" . - $e->getMessage() . "\n" . - $e->getTraceAsString()); + $e->getMessage() . "\n" . $e->getTraceAsString()); return false; } @@ -192,7 +191,7 @@ class graphics_Core { } if (filesize($input_file) == 0) { - throw new Exception("@todo MALFORMED_INPUT_FILE"); + throw new Exception("@todo EMPTY_INPUT_FILE"); } $dims = getimagesize($input_file); diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index c1c005f5..a4bc853b 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -53,6 +53,10 @@ class photo_Core { throw new Exception("@todo NAME_CANNOT_END_IN_PERIOD"); } + if (filesize($filename) == 0) { + throw new Exception("@todo EMPTY_INPUT_FILE"); + } + $image_info = getimagesize($filename); // Force an extension onto the name |
