diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index fef6e5051..1e2c3c922 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -1906,6 +1906,43 @@ class e_parse extends e_parser + + + /** + * Set or Get the value of the thumbNail Width. + * @param $width (optional) + */ + public function thumbWidth($width=null) + { + if($val !== null) + { + $this->thumbWidth = intval($width); + } + + return $this->thumbWidth; + } + + + + + + /** + * Set or Get the value of the thumbNail height. + * @param $height (optional) + */ + public function thumbHeight($height= null) + { + if($val !== null) + { + $this->thumbHeight = intval($height); + } + + return $this->thumbHeight; + + } + + + /** * Generate an auto-sized Image URL. * @param $url - path to image or leave blank for a placeholder. diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 15198e9d7..655d9cfef 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -362,6 +362,9 @@ class e_media /** * Return an array of Images in a particular category * @param string $cat : category name. use + to include _common eg. 'news+' + * @param $from + * @param $amount + * @param $search */ public function getImages($cat='', $from=0, $amount=null,$search=null) { diff --git a/e107_plugins/gallery/e_shortcode.php b/e107_plugins/gallery/e_shortcode.php index 7724a02f0..09a13c424 100644 --- a/e107_plugins/gallery/e_shortcode.php +++ b/e107_plugins/gallery/e_shortcode.php @@ -72,10 +72,10 @@ class gallery_shortcodes extends e_shortcode $tp = e107::getParser(); $parms = eHelper::scParams($parm); - $w = vartrue($parms['w']) ? $parms['w'] : 190; // 160; - $h = vartrue($parms['h']) ? $parms['h'] : 130; + $w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160; + $h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight(); // 130; - $class = ($this->slideMode == TRUE) ? 'gallery-slideshow-thumb' : 'gallery-thumb'; + $class = ($this->slideMode == TRUE) ? 'gallery-slideshow-thumb img-responsive' : varset($parms['class'],'gallery-thumb img-responsive'); // $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery'; $rel = ($this->slideMode == TRUE) ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]'; $att = 'aw='.$w.'&ah='.$h.'&x=1'; // 'aw=190&ah=150'; @@ -143,7 +143,7 @@ class gallery_shortcodes extends e_shortcode if(isset($parms['thumbsrc'])) return e107::getParser()->thumbUrl($this->var['media_cat_image'],$att); $text = ""; - $text .= ""; + $text .= ""; $text .= ""; return $text; } @@ -167,6 +167,45 @@ class gallery_shortcodes extends e_shortcode return e107::getParser()->parseTemplate($template['slideshow_wrapper']); } + /** + * Display a Grid of thumbnails - useful for home pages. + * Amount per row differs according to device, so they are not set here, only the amount. + * @example {GALLERY_PORTFOLIO: placeholder=1&category=2} + */ + function sc_gallery_portfolio($parms='') + { + $ns = e107::getRender(); + $parm = eHelper::scParams($parms); + $cat = ($parm['category']) ? $parm['category'] : vartrue(e107::getPlugPref('gallery','slideshow_category'), 1); //TODO Separate pref? + + $tmpl = e107::getTemplate('gallery','gallery'); + $limit = vartrue($parm['limit'], 6); + + $list = e107::getMedia()->getImages('gallery_'.$cat.'|gallery_image_'.$cat, 0, $limit); + + if(count($list) < 1 && vartrue($parm['placeholder'])) + { + $list = array(); + + for ($i=0; $i < $limit; $i++) + { + $list[] = array('media_url'=>''); + } + } + + //NOTE: Using tablerender() allows the theme developer to set the number of columns etc using col-xx-xx + foreach($list as $val) + { + $this->var = $val; + $text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'),'gallery_portfolio',true); + } + + return $text; + + } + + + /** * All possible parameters * {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM} diff --git a/e107_themes/bootstrap3/theme.php b/e107_themes/bootstrap3/theme.php index 05e5df448..955a5d886 100644 --- a/e107_themes/bootstrap3/theme.php +++ b/e107_themes/bootstrap3/theme.php @@ -70,6 +70,15 @@ function tablestyle($caption, $text, $mode='') return; } + + if($style == 'portfolio') + { + echo ' +
+ '.$text.' +
'; + return; + } echo '

'.$caption.'

@@ -143,7 +152,7 @@ $LAYOUT['jumbotron_home'] = <<
-

Display Some Work on the Home Page Portfolio (TO-DO)

+

Display Some Work on the Home Page Portfolio


-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
+ + {SETSTYLE=portfolio} + {SETIMAGE: w=700&h=500&crop=1} + {GALLERY_PORTFOLIO: placeholder=1&limit=6} +