From 09923ad54bd7f0b470dfb16b070c80631e7d706e Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 12 Mar 2016 00:15:29 -0800 Subject: [PATCH] Banner width may now be set on a per-menu basis. --- e107_handlers/e_parse_class.php | 7 ++++++- e107_plugins/banner/admin_banner.php | 2 +- e107_plugins/banner/banner_menu.php | 11 +++++++---- e107_plugins/banner/e_menu.php | 1 + e107_plugins/banner/e_shortcode.php | 6 ++++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index ab67ff4f8..df5b4a135 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -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); } diff --git a/e107_plugins/banner/admin_banner.php b/e107_plugins/banner/admin_banner.php index 786dff993..fe57c1e79 100644 --- a/e107_plugins/banner/admin_banner.php +++ b/e107_plugins/banner/admin_banner.php @@ -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', ), diff --git a/e107_plugins/banner/banner_menu.php b/e107_plugins/banner/banner_menu.php index c8411de78..a811662a2 100644 --- a/e107_plugins/banner/banner_menu.php +++ b/e107_plugins/banner/banner_menu.php @@ -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(); diff --git a/e107_plugins/banner/e_menu.php b/e107_plugins/banner/e_menu.php index 5c26cd989..645d658f9 100644 --- a/e107_plugins/banner/e_menu.php +++ b/e107_plugins/banner/e_menu.php @@ -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; diff --git a/e107_plugins/banner/e_shortcode.php b/e107_plugins/banner/e_shortcode.php index f777ba317..96f03975e 100644 --- a/e107_plugins/banner/e_shortcode.php +++ b/e107_plugins/banner/e_shortcode.php @@ -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 = "".$row["; + // $ban_ret = "".$row["; + + $ban_ret = $tp->toImage($src, array('class'=>'e-banner img-responsive', 'alt'=>$row['banner_clickurl'])); break;