Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- function returnimages($dirname="<$MTBlogSitePath$>images/beadcolors/") {
- $pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)";
- $files = array();
- $curimage=0;
- if($handle = opendir($dirname)) {
- while(false !== ($file = readdir($handle))){
- if(eregi($pattern, $file)){ //if this file is a valid image
- //Output it as a list of linked images
- $name=eregi_replace($pattern,'',$file);
- $colorname=eregi_replace('_',' ',$name);
- echo '<a href="javascript:void(0);" onclick="addcolor(\''.$colorname.'\');" title="'.$colorname.'"><img src="/images/beadcolors/'.$file.'" alt="'.$colorname.'" /></a>';
- echo "\n";
- $curimage++;
- }
- }
- closedir($handle);
- }
- return($files);
- }
- returnimages() //Output the array elements containing the image file names
- ?>
Add Comment
Please, Sign In to add comment