The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
Thumb List
Posted by: thumbList | March 31, 2009 @ 11:19am
PHP Code
[
Download
]
<?php function thumbList($folder, $thumb, $img) { $banned = array(".", "..", "index.php", "error_log"); //leave blank $html = '<ul class="thumbNail">'; if ($handle = opendir($folder)) { // List all the files while ( false !== ( $file = readdir($handle) ) ) { $pos = strrpos($file, "."); $ok = false; if( !in_array($file, $banned) && $pos ) { //if file contains _thumb, do not link to it if(strstr($file, "_thumb")) { $ok=false; } else { $ok=true; } $file = substr($file, 0, $pos); //if the item is the normal img, display corresponding thumb and link to large img if($ok) $html .= "<li><a href='$file$img' title='$file'><img src='$file$thumb' /></a></li>"; } } closedir($handle); $html .= '</ul>'; echo $html; } } //Set all your variables here and call the function for each folder $folder = "."; $thumb = "_thumb.jpg"; $img = ".jpg"; thumbList($folder, $thumb, $img); ?> </ul>
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.49 / 8
169 Votes
http://codebin.yi.org/266
page generated in 0.01 seconds