From efc86a286588f5e973a9ee0b06f30ee581f1d127 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 4 Jan 2019 10:46:44 +0800 Subject: [PATCH] Fix #1410 - Your site roojs.com --- DataObjects/Cms_page.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/DataObjects/Cms_page.php b/DataObjects/Cms_page.php index 8bb11744..f2c3184c 100644 --- a/DataObjects/Cms_page.php +++ b/DataObjects/Cms_page.php @@ -429,8 +429,7 @@ class Pman_Cms_DataObjects_Cms_page extends DB_DataObject continue; } } - - + foreach ($xpath->query('//img[@src]') as $a) { $src = $a->getAttribute('src'); $matches = array(); @@ -447,8 +446,11 @@ class Pman_Cms_DataObjects_Cms_page extends DB_DataObject if (!isset($imap[$matches[1]])) { continue; } - $width = $a->hasAttribute('width') ? ((int)$a->getAttribute('width')) : false; - $height= $a->hasAttribute('height') ? ((int)$a->getAttribute('height')) : false; + $width = $a->hasAttribute('width') ? $a->getAttribute('width') : false; + $height= $a->hasAttribute('height') ? $a->getAttribute('height') : false; + $width = $width == false || strpos($width,'%') != -1 ? false : (int) $width; + $height = $height== false || strpos($height,'%') != -1 ? false : (int) $height; + // convert into scaled... switch(true) { case ($width === false && $height == false): -- 2.39.2