From 90aa22e993df7e66fa2ea562a5b057d809d9446d Mon Sep 17 00:00:00 2001 From: Andrew O'Neil Date: Wed, 7 Nov 2007 21:39:57 +0000 Subject: [PATCH] #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 --- forms/HtmlEditorField.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index f40ba7a62..4acaefb96 100755 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -89,6 +89,8 @@ class HtmlEditorField extends TextareaField { $content = eregi_replace('width=([0-9]+)','width="\\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('/(]* )(width="|height="|src=")([^"]+)("[^>]* )(width="|height="|src=")([^"]+)("[^>]* )(width="|height="|src=")([^"]+)("[^>]*>)/i', "HtmlEditorField_dataValue_processImage", $content); @@ -118,7 +120,7 @@ class HtmlEditorField extends TextareaField { // $candidateFile->destroy(); } } - + $images = HTTP::getImagesIn($content); if($images){ @@ -196,6 +198,7 @@ function HtmlEditorField_dataValue_processImage($parts) { $info[$parts[8]] = $parts[9]; $partSource[$parts[8]] = 9; $src = Director::makeRelative($info['src="']); + if(substr($src,0,10) == '../assets/') $src = substr($src,3); $width = $info['width="']; @@ -206,7 +209,7 @@ function HtmlEditorField_dataValue_processImage($parts) { } // find the image inserted from the HTML editor - $image = Image::find($src); + $image = Image::find(urldecode($src)); if($image) { // If we have an image, generate the resized image.