From 6f06be0b5db507ddbea4f62627aa0cc8d5eac706 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 23 May 2012 10:23:01 +0800 Subject: [PATCH] Images.php --- Images.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Images.php b/Images.php index 976b78cb..4b2bbd75 100644 --- a/Images.php +++ b/Images.php @@ -211,7 +211,7 @@ class Pman_Core_Images extends Pman static function replaceImgURLS($html, $baseURL) { - preg_match_all('/]+>/i',$html, $result); + preg_match_all('/]+>/i',$html, $result); $matches = array_unique($result[0]); foreach($matches as $img) { @@ -229,7 +229,23 @@ class Pman_Core_Images extends Pman $html = self::replaceImgUrl($html, $baseURL, $img, $attr, $attr['src'] ); } - + $result = array(); + preg_match_all('/]+>/i',$html, $result); + + $matches = array_unique($result[0]); + foreach($matches as $img) { + $imatch = array(); + preg_match_all('/(width|height|src)="([^"]*)"/i',$img, $imatch); + // build a keymap + $attr = array(); + + foreach($imatch[1] as $i=>$key) { + $attr[$key] = $imatch[2][$i]; + } + if (!isset($attr['src'])) { + continue; + } + return $html; -- 2.39.2