Созонов Алексей

Веб-разработчик

Масштабирование изображения php

09.08.2015

<?php

$fn = '/images/img1.png';
$size = getimagesize($fn);
$ratio = $size[0]/$size[1]; // width/height
if( $ratio > 1) {
    $width = 500;
    $height = 500/$ratio;
}
else {
    $width = 500*$ratio;
    $height = 500;
}

?>

#PHP