$path = $_GET["path"]; if( !isset( $path ) || $path == "" ) { $path = "fotos"; } $topw=150; $toph=150; $f_arr = array(); $f = 0; if( is_dir( $path ) ) { if( $handle = opendir( $path ) ) { while( false !== ( $file = readdir( $handle ) ) ) { if( $file != "." && $file != ".." && $file[0] != "." ) { if( false == (is_dir( $path . "/" . $file ) ) ) { $f_arr[$f++] = $file; } } } } if( is_dir( $handle ) ) closedir( $handle ); sort( $f_arr ); natcasesort( $f_arr ); #reset( $f_arr ); $d_prev = substr( $path, 0, ( strrpos( dirname( $path . "/." ), "/" ) ) ); for( $i=0; $i < count( $f_arr ); $i++ ) { $ext = strtolower(substr($f_arr[$i],strlen($f_arr[$i])-3,3)); if (($ext=='jpg')||($ext=='gif')||($ext=='png')|| ($ext=='wmv')){ echo '
'; $mi ='false'; $miarx = substr($f_arr[$i],0,strlen($f_arr[$i])-3); if (file_exists($path.'/_mini/'.$miarx.'jpg')){ $mini = $path.'/_mini/'.$miarx.'jpg'; $mi ='true'; } elseif (file_exists($path.'/_mini/'.$miarx.'gif')){ $mini = $path.'/_mini/'.$miarx.'gif'; $mi ='true'; } elseif (($ext=='jpg')||($ext=='gif')||($ext=='png')){ $mini = $path.'/'.$f_arr[$i]; $mi ='true'; } if ($mi =='true'){ $size = getimagesize("$mini"); $height = $size[1]; $width = $size[0]; if ($width > $topw){$width = $topw; $height= ($height * ($topw/$size[0])); } else { if ($height > $toph){$height = $toph; $width= ($width * ($toph/$size[1]));} } echo '
'; echo '
'; } else { echo '
'; echo $f_arr[$i].'
'; } if (!(($ext=='jpg')||($ext=='gif')||($ext=='png'))){ echo '
'; echo $f_arr[$i].'
'; } if( filesize( $path . "/" . $f_arr[$i] ) >= 1024 ) { #Kb print " ".round(filesize($path."/".$f_arr[$i])/1024,1)." Kb"; } elseif( filesize( $path . "/" . $f_arr[$i])>=1048576 ) { #Mb print " ".round(filesize($path."/".$f_arr[$i])/1024/1024,1 )." Mb"; } else { #bytes print " " . filesize( $path . "/" . $f_arr[$i] ) . " bytes"; } print "
"; } } } ?>