mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #4787 from marijnkampf/patch-6
Fix Fatal error on invalid image
This commit is contained in:
commit
d9c38aa3cf
@ -870,11 +870,13 @@ class UploadField extends FileField {
|
|||||||
$width = $this->getPreviewMaxWidth();
|
$width = $this->getPreviewMaxWidth();
|
||||||
$height = $this->getPreviewMaxHeight();
|
$height = $this->getPreviewMaxHeight();
|
||||||
if ($file->hasMethod('getThumbnail')) {
|
if ($file->hasMethod('getThumbnail')) {
|
||||||
return $file->getThumbnail($width, $height)->getURL();
|
$r = $file->getThumbnail($width, $height);
|
||||||
|
if ($r) return $r->getURL();
|
||||||
} elseif ($file->hasMethod('getThumbnailURL')) {
|
} elseif ($file->hasMethod('getThumbnailURL')) {
|
||||||
return $file->getThumbnailURL($width, $height);
|
return $file->getThumbnailURL($width, $height);
|
||||||
} elseif ($file->hasMethod('Fit')) {
|
} elseif ($file->hasMethod('Fit')) {
|
||||||
return $file->Fit($width, $height)->getURL();
|
$r = $file->Fit($width, $height);
|
||||||
|
if ($r) return $r->getURL();
|
||||||
} else {
|
} else {
|
||||||
return $file->Icon();
|
return $file->Icon();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user