BUGFIX Ensure that the return object of File::find() is an instance of Image in HtmlEditorField_readonly::HtmlEditorField_dataValue_processImage()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@76374 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-05-07 06:18:04 +00:00 committed by Sam Minnee
parent 2f61a5a84f
commit 66fe1a1838

View File

@ -234,7 +234,7 @@ function HtmlEditorField_dataValue_processImage($parts) {
$image = Image::find(urldecode($src));
// If we have an image, insert the resampled one into the src attribute; otherwise, leave the img src alone.
if($image && $image->getWidth() != $width && $image->getHeight() != $height) {
if($image && ($image instanceof Image) && ($image->getWidth() != $width) && ($image->getHeight() != $height)) {
// If we have an image, generate the resized image.
$resizedImage = $image->getFormattedImage('ResizedImage', $width, $height);
if($resizedImage) $parts[$partSource['src="']] = $resizedImage->getRelativePath();