<% include "../assets/database_connect.php"; include "../assets/common_scripts.php"; $today = Date("Y-m-d"); $eventid = $_GET['eventid']; // The following reroutes the user to the new event photos page in case they are clicking a link from an old news article. header('Location: event_gallery_v2.php?eventid=' . $eventid) ; //Retrieve Info about the event... $eventquery = "SELECT * FROM Event WHERE iEventID=" . $eventid; $eventresult = mysql_query($eventquery); $eventdate = mysql_result($eventresult, $count, "dtEventDate"); $eventtitle = mysql_result($eventresult, $count, "vchEventTitle"); $photogallery = mysql_result($eventresult, $count, "tiPhotoGallery"); $eventdate = date("l, F j, Y", strtotime($eventdate)); if (strtotime($today) > strtotime($eventdate)) { $breadcrumb = "Past Events"; } else { $breadcrumb = "Upcoming Events"; } //Remove _vti_cnf directory if it exists. delete_directory("/home/mocsemor/www/events/galleries/" . $eventid . "/_vti_cnf"); //Retrieve info about the photo gallery... $photos = scandir("/home/mocsemor/www/events/galleries/" . $eventid); //First 2 file names are . and .. so array of filenames starts at 2 $numberofphotos = count($photos) - 2; $photosperpage = 20; if ($numberofphotos / $photosperpage == floor($numberofphotos / $photosperpage)) { $numberofpages = floor($numberofphotos / $photosperpage); } else { $numberofpages = floor($numberofphotos / $photosperpage) + 1; } $currentpage = $_GET['page']; if ($currentpage <= 0) { $currentpage = 1; } $nextpage = $currentpage + 1; $prevpage = $currentpage - 1; $firstphotoonpage = (($currentpage - 1) * $photosperpage) + 1; $lastphotoonpage = $firstphotoonpage + $photosperpage - 1; if ($lastphotoonpage > $numberofphotos) { $lastphotoonpage = $numberofphotos; } %> Mustang Owners Club of Southeastern Michigan <%include ('../assets/header.php');%>
<%include ('../assets/leftnavigation.php');%>

 

<%= $eventtitle%>

<%= $eventdate%>

 

<% for ($photocount = $firstphotoonpage; $photocount <= $lastphotoonpage; $photocount = $photocount + 2) { //NOTE: Since the first two files in the directory are . and .., we need to add 2 to the photo count to pull the correct filename $leftphoto = $photocount + 1; $rightphoto = $photocount + 2; %> <% } %>
<% if ($leftphoto - 1 <= $numberofphotos) { list($leftphotowidth, $leftphotoheight, $leftphototype, $leftphotoattr) = getimagesize("galleries/$eventid/$photos[$leftphoto]"); $leftphotoratio = $leftphotowidth / $leftphotoheight; if ($leftphotoratio > 1.34) { $leftphotowidth = 250; $leftphotoheight = $leftphotowidth / $leftphotoratio; } else { $leftphotoheight = 187; $leftphotowidth = $leftphotoheight * $leftphotoratio; } %> <% } %> <% if ($rightphoto - 1 <= $numberofphotos) { list($rightphotowidth, $rightphotoheight, $rightphototype, $rightphotoattr) = getimagesize("galleries/$eventid/$photos[$rightphoto]"); $rightphotoratio = $rightphotowidth / $rightphotoheight; if ($rightphotoratio > 1.34) { $rightphotowidth = 250; $rightphotoheight = $rightphotowidth / $rightphotoratio; } else { $rightphotoheight = 187; $rightphotowidth = $rightphotoheight * $rightphotoratio; } %> <% } %>
<%include ('../assets/footer.php');%> <% mysql_close(); %>