All pastes #187835 Raw Edit

Mine

public php v1 · immutable
·published 2006-10-01 14:56 UTC
rendered paste body
			<?php			if ($handle = opendir('.')) {    			while (false !== ($file = readdir($handle))) {    			     if ($file != "." && $file != ".." && $file != "index.php"  && $file != "digi.css"  && $file != "thumbs" && $file != "banners"  && $file != ".htaccess")  {            			$im_file_name = $file;            			$image_attribs = getimagesize($im_file_name);                        //check filetype                        switch($image_attribs['mime']){                            case "image/jpg":                            $im_old = imageCreateFromJpeg($im_file_name);                            break;                            case "image/gif":                            $im_old = imagecreatefromGif($im_file_name);                            break;                            case "image/png":                            $im_old = imagecreatefromPng($im_file_name);                            break;                            default:                            $im_old = imageCreateFromJpeg($im_file_name);                            break;                        }            			$th_max_width = 100;            			$th_max_height = 100;            			$ratio = ($width > $height) ? $th_max_width/$image_attribs[0] : $th_max_height/$image_attribs[1];            			$th_width = $image_attribs[0] * $ratio;            			$th_height = $image_attribs[1] * $ratio;            			$im_new = imagecreatetruecolor($th_width,$th_height);            			imageAntiAlias($im_new,true);            			$th_file_name = "thumbs/th_$file";						$file_size = (filesize($file) / 1024);            			imageCopyResampled($im_new,$im_old,0,0,0,0,$th_width,$th_height, $image_attribs[0], $image_attribs[1]);            			//check filetype                        switch($image_attribs['mime']){                            case "image/jpeg":                            imageJpeg($im_new,$th_file_name,100);                            break;                                                        case "image/gif":                            imageGif($im_new,$th_file_name);                            break;                                                        case "image/png":                            imagePng($im_new,$th_file_name);                            break;                                                        default:                            imageJpeg($im_new,$th_file_name,100);                            break;                        }                                        			echo "<div class='image_contain'>								<div class='image_frame'><a href='http://".$DirNow."/".$file."'><img src='thumbs/th_".$file."' /></a></div>								<div class='image_info'>&nbsp;&nbsp;Name:<strong> ".$file." </strong><br />									&nbsp;&nbsp;Size:<strong> ".$file_size." kb</strong><br />									&nbsp;&nbsp;Modified:<strong> ".date ("M d Y H:i:s.", filemtime($file))." </strong></div>							</div>"						;			         }			     }				closedir($handle);			}		?>