diff --git a/www/data/images/logo.png b/www/data/images/logo.png index 6f2dff4..02c3f71 100644 Binary files a/www/data/images/logo.png and b/www/data/images/logo.png differ diff --git a/www/internals/base.php b/www/internals/base.php index d58f334..786a160 100644 --- a/www/internals/base.php +++ b/www/internals/base.php @@ -296,7 +296,16 @@ function smart_resize_image($file, $width = 0, $height = 0, $proportional, $outp */ function magick_resize_image($file, $width, $height, $output) { - $cmd = 'convert "' . $file . '" -strip -resize ' . $width . 'x' . $height . ' "' . $output . '"'; + list($width_old, $height_old) = getimagesize($file); + + if ($width == 0) $factor = $height/$height_old; + elseif ($height == 0) $factor = $width/$width_old; + else $factor = min( $width / $width_old, $height / $height_old ); + + $final_width = round( $width_old * $factor ); + $final_height = round( $height_old * $factor ); + + $cmd = 'convert "' . $file . '" -strip -resize ' . $final_width . 'x' . $final_height . ' "' . $output . '"'; shell_exec($cmd); } @@ -354,4 +363,4 @@ function get_client_ip() { else if(isset($_SERVER['HTTP_FORWARDED'])) return $_SERVER['HTTP_FORWARDED']; else if(isset($_SERVER['REMOTE_ADDR'])) return $_SERVER['REMOTE_ADDR']; else return 'UNKNOWN'; -} \ No newline at end of file +}