Skip to content

Commit

Permalink
BUGFIX Ensure that the return object of File::find() is an instance o…
Browse files Browse the repository at this point in the history
…f 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
  • Loading branch information
Sean Harvey authored and Sam Minnee committed Feb 2, 2011
1 parent 2f61a5a commit 66fe1a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions forms/HtmlEditorField.php
Expand Up @@ -234,12 +234,12 @@ 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();
}

$parts[0] = "";
$result = implode("", $parts);

Expand Down

0 comments on commit 66fe1a1

Please sign in to comment.