
Here is my gallery page: http://animatorx.net/Minecraft/gallery/gallery.php
gallery.php code:
<?php include("gallery_script.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>X-Craft - Gallery</title> <link href="../css/style.css" rel="stylesheet" type="text/css" /> <link href="../css/header.css" rel="stylesheet" type="text/css" /> <link href="../css/footer.css" rel="stylesheet" type="text/css" /> </head> <!--Start Header--> <?php require($DOCUMENT_ROOT . "header.php"); ?> <!--End Header--> <body> <!--Start Main Content--> <div id="index_body_container"> <div id="collumn_1_container"> <div id="index_body_collumn_1"> <div id="collumn_1_header"> <center>Latest Pictures</center> </div> <div id="collumn_1_middle_2"> <?php foreach ($images as $image){ if (file_exists("./thumbs/{$image}")) { echo "<a href=\"{$image}\"><img src=\"thumbs/{$image}\" alt=\"{$image}\" /></a>"; } else { echo "<a href=\"{$image}\"><img src=\"?img={$image}\" alt=\"{$image}\" /></a>"; } } ?> </div> <div id="collumn_1_footer"> </div> </div> </div> <div id="collumn_2_container"> <div id="index_body_collumn_2"> <div id="collumn_2_header"><center>About The Gallery</center> </div> <div id="collumn_2_middle_dynamic"> <!-- Stuff Here --> This is the brand new X-Craft public gallery! Here you can upload your best minecraft creations, or just funny ingame screen shots! Infact, it doesnt even need to be made in minecraft! just upload any picture you like, whether it be fan art, creations, funny pictures, as long as its related to minecraft, feel free to submit it! <a href="#">Upload an image!</a> </div> <div id="collumn_2_footer"> </div> </div> </div> </div> <!--End Main Content--> <!--Start Footer--> <?php require($DOCUMENT_ROOT . "../footer.php"); ?> <!--End Footer--> </body> </html>gallery_script.php
<?php if (isset($_GET['img'])) { //make thumbnail if (file_exists($_GET['img'])) { ignore_user_abort(true); set_time_limit(120); ini_set('memory_limit', '520M'); $src_size = getimagesize($_GET['img']); if ($src_size === false) { die('The image you are trying to view is invalid.'); } $thumb_width = 100; $thumb_height = 80; if ($src_size['mime'] === 'image/jpeg') { $src = imagecreatefromjpeg($_GET['img']); } else if ($src_size['mime'] === 'image/png') { $src = imagecreatefrompng($_GET['img']); } else if ($src_size['mime'] === 'image/gif') { $src = imagecreatefromgif($_GET['img']); } $src_aspect = round(($src_size[0] / $src_size[1]), 1); $thumb_aspect = round(($thumb_width / $thumb_height), 1); if ($src_aspect < $thumb_aspect) { //higher $new_size = array($thumb_width, ($thumb_width / $src_size[0]) * $src_size[1]); $src_pos = array(0, (($new_size[1] - $thumb_height) * ($src_size[0] / $new_size[0])) / 2); } else if ($src_aspect > $thumb_aspect) { //wider $new_size = array(($thumb_width / $src_size[1]) * $src_size[0], $thumb_height); $src_pos = array((($new_size[0] - $thumb_width) * ($src_size[0] / $new_size[0])) / 2, 0); } else { //same shape $new_size = array($thumb_width, $thumb_height); $src_pos = array(0, 0); } if ($new_size[0] < 1) $new_size[0] = 1; if ($new_size[1] < 1) $new_size[1] = 1; $thumb = imagecreatetruecolor($thumb_width, $thumb_height); imagecopyresampled($thumb, $src, 0, 0, $src_pos[0], $src_pos[1], $new_size[0], $new_size[1], $src_size[0], $src_size[1]); if ($src_size['mime'] === 'image/jpeg'){ imagejpeg($thumb, "thumbs/{$_GET['img']}"); } else if ($src_size['mime'] === 'image/png'){ imagepng($thumb, "thumbs/{$_GET['img']}"); } else if ($src_size['mime'] === 'image/gif'){ imagegif($thumb, "thumbs/{$_GET['img']}"); } header("Location: thumbs/{$_GET['img']}"); } die(); } if (is_dir('./thumbs') === false) { mkdir('./thumbs', 0744); } $images = glob('images/*.{jpg,jpeg,png,gif}', GLOB_BRACE); ?>I've just started trying to learn php, but I can't find my probably obvious mistake

(i didnt know whether to post this in the tutorial problems forum thing, or here, because this isnt really an issue with the tutorial code :s so sorry if its in the wrong place
