<div class='container p-0'>
	<div class="row">
		<?php 
			// Image extensions
			$image_extensions = array("png","jpg","jpeg","gif","webp");
			// Target directory
			$dir = 'image/galeria/thumb/';
			if (is_dir($dir)){
			if ($dh = opendir($dir)){
			$count = 1;
			//
			
			// Read files
			while (($file = readdir($dh)) !== false){
				if($file != '' && $file != '.' && $file != '..'){
				// Thumbnail image path
				$thumbnail_path = "$url/image/galeria/thumb/".$file; //thumbnail/
				// Image path
				$image_path = "$url/image/galeria/thumb/".$file;
				$thumbnail_ext = pathinfo($thumbnail_path, PATHINFO_EXTENSION);
				$image_ext = pathinfo($image_path, PATHINFO_EXTENSION);
				// Check its not folder and it is image file
				if(!is_dir($image_path) && 
				in_array($thumbnail_ext,$image_extensions) && 
				in_array($image_ext,$image_extensions)){
		?>
		
		
		
<?php /*?>		//href="<?php echo $image_path; ?>"
		<button type="button" style="width:150px" onclick="modalOnclick(this)">
			<img class="img-fluid" src="<?=$url;?>image/logo.png">
		</button><?php */?>
		
		<?php
			$x = pathinfo($file, PATHINFO_FILENAME);
			$y = ucfirst($x);
			$teste = preg_replace(array('/-/', '/_/'),' ', $y);
		?>
		<button class="col-lg-3" type="button" onclick="modalOnclick(this)">
			<img class="img-fluid" src="<?php echo $thumbnail_path; ?>" alt="<?=$h1?>" title="<?=$h1?>">
		</button>

		<?php

			// Break
			if( $count%4 == 0){
		?>
		<div class="clear"></div>
		<?php 
			}
			$count++;
					}
				}

			}
		closedir($dh);
		}
		}
		?>
	</div>
</div>
<?php include("modal.php"); ?>