fixed magick images
This commit is contained in:
parent
ca07729318
commit
e2a4b519b5
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 17 KiB |
@ -296,7 +296,16 @@ function smart_resize_image($file, $width = 0, $height = 0, $proportional, $outp
|
|||||||
*/
|
*/
|
||||||
function magick_resize_image($file, $width, $height, $output)
|
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);
|
shell_exec($cmd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user