public function setWidthAndHeight($width = 0, $height = 0)
{
$xratio = $width / $this->width;
$yratio = $height / $this->height;
if ($this->resizeProportional && !($width == 0 || $height == 0)) {
if ($xratio * $this->height < $height) {
$this->height = (int) ceil($xratio * $this->height);
$this->width = $width;
} else {
$this->width = (int) ceil($yratio * $this->width);
$this->height = $height;
}
}
return $this;
}