0) ? (int)$_GET['maxItemsPerRow']-1 : 1; $defaultWidth = (isset($_GET['defaultWidth']) && (int)$_GET['defaultWidth'] > 0) ? (int)$_GET['defaultWidth'] : 150; $defaultHeight = (isset($_GET['defaultHeight']) && (int)$_GET['defaultHeight'] > 0) ? (int)$_GET['defaultHeight'] : 100; $imagesFirst = isset($_GET['imagesFirst']); /** * Calculates resized size based on $dstHeight and $dstWidth by maintaining the * original width-height-ratio. Checks which dimension is greater and sets it to * a fixed value specified. The remaining dimension is resized using the * original ratio to the other dimension's new fixed value. * @param $srcFile * @param $dstHeight * @param $dstWidth * @return [0]=width, [1]=height */ function getResizeSize($srcFile, $dstHeight, $dstWidth) { $srcFileInfo = getimagesize($srcFile); //[0]=width,[1]=height if(empty($srcFileInfo)) throw new Exception('Failed to read image fileinfo.'); if($srcFileInfo[0] <= (int)$dstWidth && $srcFileInfo[1] <= (int)$dstHeight) { return array($srcFileInfo[0], $srcFileInfo[1]); //nothing to do } $newSize = array(); if($srcFileInfo[0] >= $srcFileInfo[1]) { //calculate new dimensions while keeping current ratio $newSize[0] = $dstWidth; $newSize[1] = ($srcFileInfo[1]/$srcFileInfo[0]) * $dstWidth; } else { $newSize[0] = ($srcFileInfo[0]/$srcFileInfo[1]) * $dstHeight; $newSize[1] = $dstHeight; } return $newSize; } ?> Custom Directory Listing


indianexpress.zip  
macworld.zip  
theguardian.zip  
universityherald.zip  
index.php