Merge pull request #4787 from marijnkampf/patch-6

Fix Fatal error on invalid image
This commit is contained in:
Daniel Hensby 2015-11-25 14:25:15 +00:00
commit d9c38aa3cf

View File

@ -870,11 +870,13 @@ class UploadField extends FileField {
$width = $this->getPreviewMaxWidth();
$height = $this->getPreviewMaxHeight();
if ($file->hasMethod('getThumbnail')) {
return $file->getThumbnail($width, $height)->getURL();
$r = $file->getThumbnail($width, $height);
if ($r) return $r->getURL();
} elseif ($file->hasMethod('getThumbnailURL')) {
return $file->getThumbnailURL($width, $height);
} elseif ($file->hasMethod('Fit')) {
return $file->Fit($width, $height)->getURL();
$r = $file->Fit($width, $height);
if ($r) return $r->getURL();
} else {
return $file->Icon();
}