mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 22:57:14 +02:00
Gallery Portfolio Thumbnails added.
This commit is contained in:
@@ -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.
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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 = "<a class='thumbnail' href='".$url."'>";
|
||||
$text .= "<img data-src='holder.js/".$w."x".$h."' src='".e107::getParser()->thumbUrl($this->var['media_cat_image'],$att)."' alt='' />";
|
||||
$text .= "<img class='img-responsive' data-src='holder.js/".$w."x".$h."' src='".e107::getParser()->thumbUrl($this->var['media_cat_image'],$att)."' alt='' />";
|
||||
$text .= "</a>";
|
||||
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}
|
||||
|
@@ -70,6 +70,15 @@ function tablestyle($caption, $text, $mode='')
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if($style == 'portfolio')
|
||||
{
|
||||
echo '
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
'.$text.'
|
||||
</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<h2>'.$caption.'</h2>
|
||||
|
||||
@@ -143,7 +152,7 @@ $LAYOUT['jumbotron_home'] = <<<TMPL
|
||||
|
||||
TMPL;
|
||||
|
||||
|
||||
//TODO Add {GALLERY_PORTFOLIO} to portfolio_menu.php
|
||||
$LAYOUT['modern_business_home'] = <<<TMPL
|
||||
|
||||
|
||||
@@ -190,27 +199,14 @@ $LAYOUT['modern_business_home'] = <<<TMPL
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2>Display Some Work on the Home Page Portfolio (TO-DO)</h2>
|
||||
<h2>Display Some Work on the Home Page Portfolio</h2>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
<a href="portfolio-item.html"><img class="img-responsive img-home-portfolio" src="http://placehold.it/700x450"></a>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
<a href="portfolio-item.html"><img class="img-responsive img-home-portfolio" src="http://placehold.it/700x450"></a>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
<a href="portfolio-item.html"><img class="img-responsive img-home-portfolio" src="http://placehold.it/700x450"></a>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
<a href="portfolio-item.html"><img class="img-responsive img-home-portfolio" src="http://placehold.it/700x450"></a>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
<a href="portfolio-item.html"><img class="img-responsive img-home-portfolio" src="http://placehold.it/700x450"></a>
|
||||
</div>
|
||||
<div class="col-lg-4 col-md-4 col-sm-6">
|
||||
<a href="portfolio-item.html"><img class="img-responsive img-home-portfolio" src="http://placehold.it/700x450"></a>
|
||||
</div>
|
||||
|
||||
{SETSTYLE=portfolio}
|
||||
{SETIMAGE: w=700&h=500&crop=1}
|
||||
{GALLERY_PORTFOLIO: placeholder=1&limit=6}
|
||||
|
||||
</div><!-- /.row -->
|
||||
|
||||
</div><!-- /.container -->
|
||||
|
Reference in New Issue
Block a user