mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
#1628 - Resizing images seems to break images, and doesn't display on front end
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44473 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
80f89535f4
commit
90aa22e993
@ -89,6 +89,8 @@ class HtmlEditorField extends TextareaField {
|
|||||||
|
|
||||||
$content = eregi_replace('width=([0-9]+)','width="\\1"',$content);
|
$content = eregi_replace('width=([0-9]+)','width="\\1"',$content);
|
||||||
$content = eregi_replace('height=([0-9]+)','height="\\1"',$content);
|
$content = eregi_replace('height=([0-9]+)','height="\\1"',$content);
|
||||||
|
$content = eregi_replace('src="([^\?]*)\?r=[0-9]+"','src="\\1"',$content);
|
||||||
|
$content = eregi_replace('mce_src="([^\?]*)\?r=[0-9]+"','mce_src="\\1"',$content);
|
||||||
|
|
||||||
$content = preg_replace_callback('/(<img[^>]* )(width="|height="|src=")([^"]+)("[^>]* )(width="|height="|src=")([^"]+)("[^>]* )(width="|height="|src=")([^"]+)("[^>]*>)/i', "HtmlEditorField_dataValue_processImage", $content);
|
$content = preg_replace_callback('/(<img[^>]* )(width="|height="|src=")([^"]+)("[^>]* )(width="|height="|src=")([^"]+)("[^>]* )(width="|height="|src=")([^"]+)("[^>]*>)/i', "HtmlEditorField_dataValue_processImage", $content);
|
||||||
|
|
||||||
@ -196,6 +198,7 @@ function HtmlEditorField_dataValue_processImage($parts) {
|
|||||||
$info[$parts[8]] = $parts[9]; $partSource[$parts[8]] = 9;
|
$info[$parts[8]] = $parts[9]; $partSource[$parts[8]] = 9;
|
||||||
$src = Director::makeRelative($info['src="']);
|
$src = Director::makeRelative($info['src="']);
|
||||||
|
|
||||||
|
|
||||||
if(substr($src,0,10) == '../assets/') $src = substr($src,3);
|
if(substr($src,0,10) == '../assets/') $src = substr($src,3);
|
||||||
|
|
||||||
$width = $info['width="'];
|
$width = $info['width="'];
|
||||||
@ -206,7 +209,7 @@ function HtmlEditorField_dataValue_processImage($parts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find the image inserted from the HTML editor
|
// find the image inserted from the HTML editor
|
||||||
$image = Image::find($src);
|
$image = Image::find(urldecode($src));
|
||||||
|
|
||||||
if($image) {
|
if($image) {
|
||||||
// If we have an image, generate the resized image.
|
// If we have an image, generate the resized image.
|
||||||
|
Loading…
Reference in New Issue
Block a user