diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-01 23:14:01 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-01 23:14:01 -0700 |
commit | 7bc40fd3152c35d95b69b320c351d91a7ca0675a (patch) | |
tree | 84c0faf1c1ea9d178fe61b7bd028c070f1b42a76 /modules | |
parent | 6f3ec5f03914324f596e51f22f2df49ec48e8053 (diff) |
Start of fixing a problem with importing movies w/o a thumbnail
Diffstat (limited to 'modules')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index c2ad443c..93d92659 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -638,33 +638,37 @@ class g2_import_Core { $target_thumb_size = module::get_var("gallery", "thumb_size"); $target_resize_size = module::get_var("gallery", "resize_size"); - foreach ($derivatives[$g2_item_id] as $derivative) { - if ($derivative->getPostFilterOperations()) { - // Let's assume for now that this is a watermark operation, which we can't handle. - continue; - } + if (!empty($derivatives[$g2_item_id])) { + foreach ($derivatives[$g2_item_id] as $derivative) { + if ($derivative->getPostFilterOperations()) { + // Let's assume for now that this is a watermark operation, which we can't handle. + continue; + } - if ($derivative->getDerivativeType() == DERIVATIVE_TYPE_IMAGE_THUMBNAIL && - $item->thumb_dirty && - ($derivative->getWidth() == $target_thumb_size || - $derivative->getHeight() == $target_thumb_size)) { - if (@copy(g2($derivative->fetchPath()), $item->thumb_path())) { - $item->thumb_height = $derivative->getHeight(); - $item->thumb_width = $derivative->getWidth(); - $item->thumb_dirty = false; + if ($derivative->getDerivativeType() == DERIVATIVE_TYPE_IMAGE_THUMBNAIL && + $item->thumb_dirty && + ($derivative->getWidth() == $target_thumb_size || + $derivative->getHeight() == $target_thumb_size)) { + if (@copy(g2($derivative->fetchPath()), $item->thumb_path())) { + $item->thumb_height = $derivative->getHeight(); + $item->thumb_width = $derivative->getWidth(); + $item->thumb_dirty = false; + } } - } - if ($derivative->getDerivativeType() == DERIVATIVE_TYPE_IMAGE_RESIZE && - $item->resize_dirty && - ($derivative->getWidth() == $target_resize_size || - $derivative->getHeight() == $target_resize_size)) { - if (@copy(g2($derivative->fetchPath()), $item->resize_path())) { - $item->resize_height = $derivative->getHeight(); - $item->resize_width = $derivative->getWidth(); - $item->resize_dirty = false; + if ($derivative->getDerivativeType() == DERIVATIVE_TYPE_IMAGE_RESIZE && + $item->resize_dirty && + ($derivative->getWidth() == $target_resize_size || + $derivative->getHeight() == $target_resize_size)) { + if (@copy(g2($derivative->fetchPath()), $item->resize_path())) { + $item->resize_height = $derivative->getHeight(); + $item->resize_width = $derivative->getWidth(); + $item->resize_dirty = false; + } } } + } else { + // @todo Figure out away to create the thumbnail and resizes? } $item->save(); } |