Hey guys, I followed a tutorial from CodeWalkers on how to create a simple image gallery which uses the file system in order to organise my images. Now I have everything working fine and I've modified the script quite a bit so it is to my liking and working all nice and dandy but I recently uploaded around 180 pictures into a folder and it just won't display the images at all. All of the other folders work fine but they are a lot less than that amount. Below is my script and links to my actual websites so that you can see what I'm talking about: [b]The Image Gallery[/b] - [url=http://www.davzie.com/index.php?page=images]http://www.davzie.com/index.php?page=images[/url] [b]Bulgaria 2005 (The Non Working Folder)[/b] - [url=http://www.davzie.com/index.php?page=images&nav=LOL%3EBulgaria%202005]http://www.davzie.com/index.php?page=images&nav=LOL%3EBulgaria%202005[/url] Perhaps you could also help me understand why I have to add a "LOL" after the nav= because if I do'nt put anything there it just ceases to work. It used to work without it but then it just stopped. [b]IMAGES.PHP[/b] [code]<?php require_once('config.php'); // grab our navigation $nav = isset($_REQUEST['nav']) ? urldecode($_REQUEST['nav']) : null; if(isset($nav)) { $crunch = explode('>', trim($nav)); foreach($crunch as $value) { // IMPORTANT! validate for teh h4x0rz if(!ctype_alnum(str_replace(' ', '', $value))) $invalid = true; } if($invalid) $nav = null; } // decide what page of a paticular gallery we're viewing $pg = isset($_REQUEST['pg']) && (ctype_digit($_REQUEST['pg']) || $_REQUEST['pg'] == 'all') ? $_REQUEST['pg'] : 0; $viewall = is_numeric($pg) ? null : true; $pg = intval($pg) <= 0 ? 1 : $pg; // images per page $section = ROWS * COLS; // last possible ending point for images, depending which page we're on $end = $section * $pg; // starting point for images, depending which page we're on $start = $end - $section; // previous page $prev = $pg - 1; // next page $next = $pg + 1; // start table print('<table border="0" align="center" cellpadding="1" cellspacing="1">'); // draw previous and next links function navigator($total) { $p = '<a href="'.$_SERVER['PHP_SELF'] .'?page=images&nav=LOL'.rawurlencode($GLOBALS['nav']) .'&pg='.$GLOBALS['prev'].'">Page '.$GLOBALS['prev'].'</a>'; $n = '<a href="'.$_SERVER['PHP_SELF'] .'?page=images&nav=LOL'.rawurlencode($GLOBALS['nav']) .'&pg='.$GLOBALS['next'].'">Page '.$GLOBALS['next'].'</a>'; $a = '<a href="'.$_SERVER['PHP_SELF'] .'?page=images&nav=LOL'.rawurlencode($GLOBALS['nav']) .'&pg=all">View All</a>'; // the navigation print('<tr><td align="center" colspan="' . COLS . '">'); if(($GLOBALS['pg'] == 1 && $GLOBALS['end'] >= $total) || isset($GLOBALS['viewall'])) { print('Page 1'); $GLOBALS['pg'] = 'all'; } elseif($GLOBALS['pg'] == 1) print('Page '.$GLOBALS['pg'].' : '.$a.' : '.$n); elseif($GLOBALS['end'] < $total) print($p.' : '.$a.' : '.$n); else print($p.' : '.$a); print('</td></tr>'); } // get directory tree function directory($dir) { $mydir = opendir($dir); while(false !== ($file = readdir($mydir))) { if($file != "." && $file != "..") { if(is_dir($dir.$file)) { chdir('.'); $tree[$file] = directory($dir.$file.'/'); chdir('..'); } else { $size = getimagesize($dir.$file); if(in_array($size['mime'], unserialize(TYPE))) $tree[] = $file; } } } closedir($mydir); return $tree; } $tree = directory(PATH); // display category links and images function display_body($navtree) { if(isset($GLOBALS['nav'])) { // we'll need the path as a directory for displaying images for($i=1; $i<count($GLOBALS['crunch']); $i++) $uri .= !is_numeric($GLOBALS['crunch'][$i]) ? $GLOBALS['crunch'][$i].'/' : ''; } if(is_array($navtree)) { if(!is_numeric(implode('', array_keys($navtree)))) { print('<tr><td>'); print('<h4>The Image Gallery:</h4><p>Here is the image gallery. At the moment I\'m working on making it much nicer and prettier but it does work as it is at the moment. Hope you enjoy it: <br><br>'); foreach($navtree as $key=>$value) { if(!is_int($key)) { if(is_array($value)) print('<a href="'.$_SERVER['PHP_SELF'] .'?page=images&nav=LOL'.rawurlencode($GLOBALS['nav'] .'>'.$key).'">'.$key.'</a><br /></div>'); else print($key.'<br />'); } } print('</td></tr>'); } else { // decide how many rows to display $total = count($navtree); if(isset($GLOBALS['viewall'])) { $check = $total / COLS; $rows = is_int($check) ? $check : floor($check) + 1; } else $rows = ROWS; list($tmp3,$categoryname) = split(">",rawurldecode($GLOBALS['nav'])); print('<h4>'.$categoryname.':</h4>'); navigator($total); print('<i>'.$total.' Photos</i>'); for($i=0; $i<$rows; $i++) { print('<tr>'); for($n=0; $n<COLS; $n++) { $index = $GLOBALS['start']++; $image = $index < $total ? $navtree[$index] : ' '; print('<td align="center" width="'.THMBWIDTH.'" height="'.THMBHEIGHT.'">'); if($image != ' ') { print('<a href="'.$_SERVER['PHP_SELF'] .'?page=images&pgnm='.$GLOBALS['pg'].'&nav=LOL'.rawurlencode($GLOBALS['nav'].'>'.$index).'">'); print('<img src="imgsrc.php?src=' .PATH.rawurlencode($uri).$image.'" border="0" />'); print('</a>'); } else print($image); print('</td>'); } print('</tr>'); } navigator($total); print('<br><br><div align="left"><br><br><a href="'.$_SERVER['PHP_SELF'].'?page=images">< < Go Back</a></div>'); } } elseif(file_exists(PATH.$uri.$navtree)) { $root = explode('/', dirname(PATH.'.')); echo('<tr><td>'); echo('<img src="'.end($root).'/'.$uri.$navtree.'"><br><br>'); list($tmp,$mynav) = split(">",rawurldecode($GLOBALS['nav'])); //Having problems here trying to get the link to go back to the last page that it was on. echo('<div align="left"><a href="'.$_SERVER['PHP_SELF'].'?page=images&nav=LOL>'.rawurlencode($mynav).'&pg='.$GLOBALS['pgnm'].'">< < Go Back</a></div></td></tr>'); } else print('<tr><td>invalid request</td></tr>'); } // navigate appropriate categories function categories($navtree) { if(isset($GLOBALS['nav'])) { for($i=1; $i<count($GLOBALS['crunch']); $i++) $navtree = &$navtree[$GLOBALS['crunch'][$i]]; display_body($navtree); } else display_body($navtree); } categories($tree); // end table print('</table>'); ?> [/code] Okay and here we have: [b]IMGSRC.PHP[/b] [code]<?php require_once('config.php'); $src = isset($_REQUEST['src']) ? urldecode($_REQUEST['src']) : null; // we're using file_exists here to prevent working with remote files if(isset($src) && file_exists($src)) { header('Content-Type: image/jpg'); list($width, $height, $type, $attr) = getimagesize($src); $img = imagecreatefromjpeg($src); $lowest = min(THMBWIDTH / $width, THMBHEIGHT / $height); if($lowest < 1) { $smallwidth = floor($lowest*$width); $smallheight = floor($lowest*$height); $tmp = imagecreatetruecolor($smallwidth, $smallheight); imagecopyresized($tmp, $img, 0, 0, 0, 0, $smallwidth, $smallheight, $width, $height); imagedestroy($img); $img = $tmp; } imagejpeg($img, '', 100); imagedestroy($img); } ?> [/code] I know that it's a huge amount of code to go through but it might be something stupidly simple that I'm not noticing because I'm not amazing at PHP and I just use it to make my website a little nicer. It's been buggered like this for a few months now and the family are nagging me to get it all back up again so that they can see the images. Thank you all in advance, David.