1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +02:00

Banner width may now be set on a per-menu basis.

This commit is contained in:
Cameron
2016-03-12 00:15:29 -08:00
parent 85f67aa084
commit 09923ad54b
5 changed files with 19 additions and 8 deletions

View File

@@ -2444,6 +2444,11 @@ class e_parse extends e_parser
$width = (!empty($parm['w'])) ? ($parm['w'] * 3) : ($this->thumbWidth * 3);
$height = (!empty($parm['h'])) ? ($parm['h'] * 3) : ($this->thumbHeight * 3);
}
elseif($width == '4x')
{
$width = (!empty($parm['w'])) ? ($parm['w'] * 4) : ($this->thumbWidth * 4);
$height = (!empty($parm['h'])) ? ($parm['h'] * 4) : ($this->thumbHeight * 4);
}
else
{
$height = (($this->thumbHeight * $width) / $this->thumbWidth);
@@ -3672,7 +3677,7 @@ class e_parser
$path = $tp->thumbUrl($file);
$srcSetParm = $parm;
$srcSetParm['size'] = '2x';
$srcSetParm['size'] = ($parm['w'] < 100) ? '4x' : '2x';
$parm['srcset'] = $tp->thumbSrcSet($file, $srcSetParm);
}

View File

@@ -125,7 +125,7 @@ class banner_ui extends e_admin_ui
'banner_tooltip' => array ( 'title' => BNRLAN_49, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => array('size'=>'xxlarge'), 'class' => 'center', 'thclass' => 'center', ),
'banner_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'textarea', 'data' => 'str', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'banner_keywords' => array ( 'title' => LAN_KEYWORDS, 'type' => 'tags', 'data' => 'str', 'width' => 'auto', 'filter' => false, 'help' => 'When news or pages are loaded, this will limit banner result to matching keywords. Use with caution.', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'banner_keywords' => array ( 'title' => LAN_KEYWORDS, 'type' => 'tags', 'data' => 'str', 'width' => 'auto', 'inline' => true, 'help' => 'When news or pages are loaded, this will limit banner result to matching keywords. Use with caution.', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'banner_startdate' => array ( 'title' => BNRLAN_17, 'type' => 'datestamp', 'tab'=>1,'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'banner_enddate' => array ( 'title' => BNRLAN_18, 'type' => 'datestamp', 'tab'=>1, 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),

View File

@@ -72,10 +72,7 @@ else
}
}
if(isset($parms['w']) && isset($parms['h'])) // TODO.
{
e107::getParser()->setThumbSize(intval($parms['w']), intval($parms['h']));
}
// print_a($menu_pref);
@@ -88,6 +85,12 @@ if(!empty($menu_pref['banner_campaign']) && !empty($menu_pref['banner_amount']))
$head = e107::getParser()->parseTemplate($BANNER_MENU_START,true);
if(!empty($menu_pref['banner_width']))
{
e107::getParser()->thumbWidth($menu_pref['banner_width']);
}
mt_srand ((double) microtime() * 1000000);
$seed = mt_rand(1,2000000000);
$time = time();

View File

@@ -34,6 +34,7 @@ class banner_menu
$fields['banner_caption'] = array('title'=> BNRLAN_37, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'));
$fields['banner_campaign'] = array('title'=> BNRLAN_39, 'type'=>'method');
$fields['banner_amount'] = array('title'=> BNRLAN_41, 'type'=>'text', 'writeParms'=>array('pattern'=>'[0-9]*'));
$fields['banner_width'] = array('title'=> "Width", 'type'=>'text', 'help'=>"In pixels", 'writeParms'=>array('pattern'=>'[0-9]*'));
$fields['banner_rendertype'] = array('title'=> BNRLAN_43, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$renderTypes));
return $fields;

View File

@@ -96,9 +96,11 @@ class banner_shortcodes extends e_shortcode
default:
$src = ($row['banner_image'][0] == '{') ? $tp->thumbUrl($row['banner_image']) : e_IMAGE_ABS.'banners/'.$row['banner_image'];
$src = ($row['banner_image'][0] == '{') ? $row['banner_image'] : e_IMAGE_ABS.'banners/'.$row['banner_image'];
$ban_ret = "<img class='e-banner img-responsive' src='".$src."' alt='".$row['banner_clickurl']."' style='border:0' />";
// $ban_ret = "<img class='e-banner img-responsive' src='".$src."' alt='".$row['banner_clickurl']."' style='border:0' />";
$ban_ret = $tp->toImage($src, array('class'=>'e-banner img-responsive', 'alt'=>$row['banner_clickurl']));
break;