From: Alan Knowles Date: Fri, 4 Jan 2019 02:46:44 +0000 (+0800) Subject: Fix #1410 - Your site roojs.com X-Git-Url: http://git.roojs.org/?p=Pman.Cms;a=commitdiff_plain;h=efc86a286588f5e973a9ee0b06f30ee581f1d127 Fix #1410 - Your site roojs.com --- 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):