$number_of_pages ) { $current_page = $number_of_pages; } else { $current_page = $_GET["page"]; } /* Just some debug prints.. echo "item_count = " . $item_count . "
"; echo "items / page = " . ( $cols_per_row * $rows_per_page ) . "
"; echo "number_of_pages = " . $number_of_pages . "
"; echo "current_page = " . $current_page . "
"; */ sort( $thumbs ); for ( $row = 0; $row < $rows_per_page; $row++ ) { echo "

\n"; for ( $col = 0; $col < $cols_per_row; $col++ ) { $i = ( ( $current_page - 1 ) * $cols_per_row * $rows_per_page ) + ( $row * $cols_per_row ) + $col; if ( $i >= $item_count ) { break; } $img_file = $thumbs[$i]; // Get image sizes $thumb_size = getimagesize( "$thumb_img_dir/$img_file" ); $small_size = getimagesize( "$small_img_dir/$img_file" ); $medium_size = getimagesize( "$medium_img_dir/$img_file" ); $orig_size = getimagesize( "$orig_img_dir/$img_file" ); echo " $thumb_size[0] ) { echo " class=\"portrait\""; } echo ">\""\n"; } echo "

\n"; } // OK, this is ugly, but.. echo "

 

\n"; echo "

\n"; for ( $i = 1; $i <= $number_of_pages; $i++ ) { if ( $i == $current_page ) { echo $i; } else { echo "" . $i . ""; } echo " "." "."\n"; } echo "

\n"; ?>