Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770
Форумы портала PHP.SU :: Версия для печати :: Как сперва пропорционально уменьшить изображение, а затем вырезать квардат?
Форумы портала PHP.SU » » Графика в PHP » Как сперва пропорционально уменьшить изображение, а затем вырезать квардат?

Страниц (1): [1]
 

1. EVOSandru6 - 13 Июня, 2014 - 07:04:00 - перейти к сообщению
Подозреваю, что решается в 2 действия.

Пробовал так:



function resizeToWidth($width) {
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$w = $this->getWidth();
$h = $this->getHeight();



imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());


imagecopy( $new_image, $this->image, 0, 0, $width, $height, $w, $h);
$this->image = $new_image;
return $this->image;
}

function getWidth() {
return imagesx($this->image);
}
function getHeight() {
return imagesy($this->image);
}

 

Powered by ExBB FM 1.0 RC1