Jump to content

Recommended Posts

Posted

So I've made a function that is supposed to look for all gallery template pages that have a minimum number of photos in it and using the bootstrap frame work, line them up to head a page.

The value passed to the function is always 12.


function minigallery($dmc, $no_pictures){
	$thumbWidth = 200;
	$thumbHeight = 200;

	$gallery_page = wire('pages')->get("template=gallery-album, DMC_select=$dmc"); //find the first l page that are gallery-album template and that match the DMC
  	$gallery_stack = $gallery_page->images;
		if($gallery_stack->count  > 11){
		$gallery_images = $gallery_stack->getRandom(12) ;
		echo "<div class='container'>
                      <div class='row'>";
		foreach($gallery_images as $gallery_image) {
			$thumb = $gallery_image->size($thumbWidth, $thumbHeight);
			echo "<div class='col-xs-1 dmc_strip'>
			      <img class='img img-responsive' src='{$thumb->url}'>
			      </div>";}
                echo "</div>
		      </div>";
}
 




					}

What i'm not sure how to do is add to the selector a count of the images. I only want it to return galleries that have at least 12 images on the page.

Could someone advise how I'd do this please?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...