diff options
Diffstat (limited to 'modules/g2_import/helpers/g2_import.php')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 1ff63e36..648f3809 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -414,13 +414,19 @@ class g2_import_Core { Kohana::log("alert", "$g2_path unsupported image type; using a placeholder gif"); $corrupt = 1; } - $item = photo::create( - $parent, - $g2_path, - $g2_item->getPathComponent(), - $g2_item->getTitle(), - self::extract_description($g2_item), - self::map($g2_item->getOwnerId())); + try { + $item = photo::create( + $parent, + $g2_path, + $g2_item->getPathComponent(), + $g2_item->getTitle(), + self::extract_description($g2_item), + self::map($g2_item->getOwnerId())); + } catch (Exception $e) { + Kohana::log("alert", "Corrupt image $g2_path\n" . + $e->getMessage() . "\n" . $e->getTraceAsString()); + $corrupt = 1; + } break; case "GalleryMovieItem": @@ -456,12 +462,18 @@ class g2_import_Core { // Why oh why did I ever approve the session id placeholder idea in G2? $g2_item_url = str_replace('&g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT', '', $g2_item_url); - $warning = - t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; " . - "(imported as <a href=\"%g3_url\">%title</a>)", - array("g2_url" => $g2_item_url, - "g3_url" => $item->url(), - "title" => $g2_item->getTitle())); + if (!empty($item)) { + $warning = + t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; " . + "(imported as <a href=\"%g3_url\">%title</a>)", + array("g2_url" => $g2_item_url, + "g3_url" => $item->url(), + "title" => $g2_item->getTitle())); + } else { + $warning = + t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed", + array("g2_url" => $g2_item_url, "title" => $g2_item->getTitle())); + } message::warning($warning); log::warning("g2_import", $warning); Kohana::log("alert", $warning); |