Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/relay/
Upload File :
Current File : /var/www/cesa.co.za/relay/gallery.php

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>

<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

<?php
// Adam Khoury PHP Image Function Library 1.0
// Function for resizing any jpg, gif, or png image files
function ak_img_resize($target, $newcopy, $w, $h, $ext) {
    list($w_orig, $h_orig) = getimagesize($target);
    
    if (file_exists($newcopy)) {
    	list($w_thumb, $h_thumb) = getimagesize($newcopy);
    	if ( ($w_thumb == $w) && ($h_thumb == $h) ) {
      	return;
    	}
    }
    
    $scale_ratio = $w_orig / $h_orig;
    if (($w / $h) > $scale_ratio) {
           $w = $h * $scale_ratio;
    } else {
           $h = $w / $scale_ratio;
    }
    $img = "";
    $ext = strtolower($ext);
    if ($ext == "gif"){ 
      $img = imagecreatefromgif($target);
    } else if($ext =="png"){ 
      $img = imagecreatefrompng($target);
    } else { 
      $img = imagecreatefromjpeg($target);
    }
    $tci = imagecreatetruecolor($w, $h);
    // imagecopyresampled(dst_img, src_img, dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h)
    imagecopyresampled($tci, $img, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
    imagejpeg($tci, $newcopy, 80);
}
?>

<ul>
<li><b><a href="/galleries/relay2017/index.html">View the 2017 Photo Gallery</a></b></li>
<!--   <li class="gallery_list"><a href="index.php?sec=gallery&catDirectory=2012">2012</a></li>
 <li class="gallery_list"><a href="index.php?sec=gallery&catDirectory=2011">2011</a></li>
  <li class="gallery_list"><a href="index.php?sec=gallery&catDirectory=2010">2010</a></li>
  -->
</ul>

<?php

if (isset($_GET['catDirectory'])) {
  $idir = "images/".$_GET['catDirectory'];
  echo '<h1 style="text-transform:uppercase">Relay '.$_GET['catDirectory'].'</h1>';

  if (is_dir($idir)) {
    if ($d = opendir($idir)){
    
      while (($file1 = readdir($d))!== false){

          /*echo ''.$idir.'/'.$file1.'~'.filetype($idir.'/'.$file1).'<br>';*/
          if ( (filetype($idir.'/'.$file1) == 'file') && (filesize($idir.'/'.$file1) > 0) ){
            
		$kaboom = explode(".", $file1); // Split file name into an array using the dot
		$fileExt = end($kaboom);
            
		$target_file = $idir.'/'.$file1;
		$resized_file = $idir.'/thumb/thumb-'.$file1;
		$wmax = 150;
		$hmax = 150;
		ak_img_resize($target_file, $resized_file, $wmax, $hmax, $fileExt);
          
            echo '<div style="float:left;postion:relative;padding:5px; width:150px; height:150px; border:1px solid #fff"><a href="'.$idir.'/'.$file1.'" rel="lightbox['.$idir.']" style="text-align:center; margin: auto 0;"><img src="'.$resized_file.'" border=0 ></a></div>';
          }		

      }
      closedir($d);
    }
  }
}

?>