mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
{SETIMAGE} can now set Height and also crop the image. eg. {SETIMAGE: w=300&h=200&crop=1}
This commit is contained in:
@@ -4,6 +4,9 @@
|
|||||||
function setimage_shortcode($parm, $mode='')
|
function setimage_shortcode($parm, $mode='')
|
||||||
{
|
{
|
||||||
e107::getParser()->thumbWidth = vartrue($parm['w'],100);
|
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;
|
var $e_query;
|
||||||
|
|
||||||
public $thumbWidth = 100;
|
public $thumbWidth = 100;
|
||||||
|
|
||||||
|
public $thumbHeight = 0;
|
||||||
|
|
||||||
// Set up the defaults
|
// Set up the defaults
|
||||||
var $e_optDefault = array(
|
var $e_optDefault = array(
|
||||||
@@ -1834,13 +1836,23 @@ class e_parse extends e_parser
|
|||||||
|
|
||||||
$thurl = 'src='.$url.'&';
|
$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));
|
$thurl .= 'aw='.((integer) vartrue($options['aw'], 0)).'&ah='.((integer) vartrue($options['ah'], 0));
|
||||||
}
|
}
|
||||||
else
|
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));
|
$thurl .= 'w='.((integer) vartrue($options['w'], 0)).'&h='.((integer) vartrue($options['h'], 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user