mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Allow insertion of <img> tags that refer to external domains
Add alt= to any images that don't have alt tags git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47820 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c22bb87647
commit
9510bad3e0
@ -223,16 +223,21 @@ function HtmlEditorField_dataValue_processImage($parts) {
|
||||
// find the image inserted from the HTML editor
|
||||
$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) {
|
||||
// If we have an image, generate the resized image.
|
||||
$resizedImage = $image->getFormattedImage("ResizedImage",$width, $height);
|
||||
$parts[$partSource['src="']] = $resizedImage->getRelativePath() ;
|
||||
} else {
|
||||
$parts[$partSource['src="']] = "";
|
||||
}
|
||||
|
||||
$parts[0] = "";
|
||||
$result = implode("", $parts);
|
||||
|
||||
// Insert an empty alt tag if there isn't one
|
||||
if(strpos($result, "alt=") === false) {
|
||||
$result = substr_replace($result, ' alt="" />', -2);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user