mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
{SETIMAGE} can now set Height and also crop the image. eg. {SETIMAGE: w=300&h=200&crop=1}
This commit is contained in:
parent
0ebbb7f15f
commit
e2dffbe0f7
@ -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);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user