mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #7607 from patricknelson/issue-7606-svg-image-tags
FIX: Prevent crash when saving page with <img> that has an SVG source.
This commit is contained in:
commit
c96ed89cbe
@ -87,13 +87,14 @@ class HtmlEditorField extends TextareaField {
|
||||
$img->setAttribute('src', preg_replace('/([^\?]*)\?r=[0-9]+$/i', '$1', $img->getAttribute('src')));
|
||||
|
||||
// Resample the images if the width & height have changed.
|
||||
if($image = File::find(urldecode(Director::makeRelative($img->getAttribute('src'))))){
|
||||
$image = File::find(urldecode(Director::makeRelative($img->getAttribute('src'))));
|
||||
if($image instanceof Image){
|
||||
$width = (int)$img->getAttribute('width');
|
||||
$height = (int)$img->getAttribute('height');
|
||||
|
||||
if($width && $height && ($width != $image->getWidth() || $height != $image->getHeight())) {
|
||||
//Make sure that the resized image actually returns an image:
|
||||
$resized=$image->ResizedImage($width, $height);
|
||||
$resized = $image->ResizedImage($width, $height);
|
||||
if($resized) $img->setAttribute('src', $resized->getRelativePath());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user