From 39bd9ba3341e358601fc7f7df11a0ec9391aae0b Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 23 Jan 2017 13:16:11 -0800 Subject: [PATCH] Don't include srcset if width and height are 0. --- e107_handlers/e_parse_class.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 90e5ad8ac..a156592b4 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -2584,6 +2584,16 @@ class e_parse extends e_parser $parm['crop'] = null; } + $defaultWidth = $this->thumbWidth(); + $defaultHeight = $this->thumbHeight(); + + + if(empty($defaultWidth) && empty($defaultHeight)) + { + return false; + } + + $parms = array('w'=>$width,'h'=>$height,'crop'=> $parm['crop'],'x'=>$parm['x'], 'aw'=>$parm['aw'],'ah'=>$parm['ah']); // $parms = !empty($this->thumbCrop) ? array('aw' => $width, 'ah' => $height, 'x'=>$encode) : array('w' => $width, 'h' => $height, 'x'=>$encode ); @@ -3906,10 +3916,18 @@ class e_parser unset($parm['src']); $path = $tp->thumbUrl($file,$parm); - $srcSetParm = $parm; - $srcSetParm['size'] = ($parm['w'] < 100) ? '4x' : '2x'; - $parm['srcset'] = $tp->thumbSrcSet($file, $srcSetParm); + + if(empty($parm['w']) && empty($parm['h'])) + { + $parm['srcset'] = false; + } + else + { + $srcSetParm = $parm; + $srcSetParm['size'] = ($parm['w'] < 100) ? '4x' : '2x'; + $parm['srcset'] = $tp->thumbSrcSet($file, $srcSetParm); + } } elseif(strpos($file,'http')===0)