'error', 'message' => 'wrong attachement' ) ); exit; } $src_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $src_file_url[0]); $sizes = getimagesize($src_file); $original[0] = $sizes[0]; $original[1] = $sizes[1]; if ($width > $sizes[0]) { $sizes[1] = ( $sizes[1] * ($width / $sizes[0]) ); $height = ceil($height); $sizes[0] = $width; } $previewWidth = min($sizes[0], 500); $previewHeight = min($sizes[1], 350); $previewRatio = 1; if ($sizes[1] / 350 < $sizes[0] / 500) { $previewHeight = $sizes[1] * $previewWidth / $sizes[0] ; $previewRatio = $sizes[1] / $previewHeight; }else { $previewWidth = $sizes[0] * $previewHeight / $sizes[1]; $previewRatio = $sizes[0] / $previewWidth; } $minWidth = min($width / $previewRatio, $previewWidth); $minHeight = min($height / $previewRatio, $previewHeight); if ($cropMethod != 0) { $aspectRatio = ($width / $height); // if ($aspectRatio * $minWidth > $sizes[0]) { // $aspectRatio = ($previewWidth / $minHeight); // } if (1 / $aspectRatio * $minHeight > $sizes[1]) { $aspectRatio = ($minWidth / $previewHeight); } if ($minWidth / $aspectRatio > $previewHeight) { $aspectRatio = $minWidth / $previewHeight; } }else { $aspectRatio = $sizes[0] / $sizes[1]; } $smallPreviewWidth = min($width, 180); $smallPreviewHeight = min($height, 180); if ($width > $height) { $smallPreviewHeight = $smallPreviewWidth * 1/ $aspectRatio; }else { $smallPreviewWidth = $smallPreviewHeight * $aspectRatio; } ?>
x px
( )

'; } ?>
/>