diff --git a/e107_core/shortcodes/single/setimage.php b/e107_core/shortcodes/single/setimage.php index 8acd92c6f..c14f96374 100644 --- a/e107_core/shortcodes/single/setimage.php +++ b/e107_core/shortcodes/single/setimage.php @@ -4,6 +4,9 @@ function setimage_shortcode($parm, $mode='') { e107::getParser()->thumbWidth = vartrue($parm['w'],100); + e107::getParser()->thumbHeight = vartrue($parm['h'],0); + e107::getParser()->thumbCrop = vartrue($parm['crop'],0); + } ?> diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index d49cfd870..eb817d7aa 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -67,6 +67,8 @@ class e_parse extends e_parser var $e_query; public $thumbWidth = 100; + + public $thumbHeight = 0; // Set up the defaults var $e_optDefault = array( @@ -1834,13 +1836,23 @@ class e_parse extends e_parser $thurl = 'src='.$url.'&'; - if(vartrue($options['aw']) || vartrue($options['ah'])) + if(vartrue($options['aw']) || vartrue($options['ah']) || $this->thumbCrop == 1) { + if($this->thumbCrop == 1 && !vartrue($options['aw']) && !vartrue($options['ah'])) // Allow templates to determine dimensions. See {SETIMAGE} + { + $options['aw'] = $this->thumbWidth; + $options['ah'] = $this->thumbHeight; + } + $thurl .= 'aw='.((integer) vartrue($options['aw'], 0)).'&ah='.((integer) vartrue($options['ah'], 0)); } else { - if(!vartrue($options['w']) && !vartrue($options['h'])) $options['w'] = $this->thumbWidth; + if(!vartrue($options['w']) && !vartrue($options['h'])) // Allow templates to determine dimensions. See {SETIMAGE} + { + $options['w'] = $this->thumbWidth; + $options['h'] = $this->thumbHeight; + } $thurl .= 'w='.((integer) vartrue($options['w'], 0)).'&h='.((integer) vartrue($options['h'], 0)); }