note 36876 deleted from function.readdir by nlopess

From: Date: Tue, 16 Dec 2003 14:49:02 +0000
Subject: note 36876 deleted from function.readdir by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62053@lists.php.net to get a copy of this message
Note Submitter: shortkid422@coastertrade.com ---- Heres a nice auto-thumbnail, non-database, auto-creation gallery, have fun. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> <TITLE>Untitled Page</TITLE> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> </HEAD> <BODY> <?php // $dir = the absolute directory link (see below example) $dir = "/home/coastert/public_html/sfgam/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file != "." && $file != "..") { // We just took out the links to the other directories (for security reasons and looks) // Now lets echo all the images into the webpage (note, you can change the hieght and width for bigger thumbnail size) // Note, the $file is the file names, so you must link it to the directory so that it can link the file properly echo "<a href='http://www.website.com/relative/link/to/directory/$file'><img src='http://www.website.com/relative/link/to/directory$file' width='80' height='60' border='0' alt='$file'>&#32"; } } closedir($dh); } } ?> </BODY> </HTML>

« previous php.notes (#62053) next »