Fix #1410 - Your site roojs.com
authorAlan Knowles <alan@roojs.com>
Fri, 4 Jan 2019 02:46:44 +0000 (10:46 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 4 Jan 2019 02:46:44 +0000 (10:46 +0800)
DataObjects/Cms_page.php

index 8bb1174..f2c3184 100644 (file)
@@ -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):