116 if($this->width == 0 || $this->height == 0)
121 if($destination->width == 0 || $destination->height == 0)
126 if($this->width == $destination->width && $this->height == $destination->height)
135 case File\Image::RESIZE_EXACT:
137 if(($this->width / $this->height) < ($destination->width / $destination->height))
146 $this->x = max(0, round(($this->width / 2) - (($destination->width / 2) / $ratio)));
147 $this->y = max(0, round(($this->height / 2) - (($destination->height / 2) / $ratio)));
149 $this->width = round($destination->width / $ratio);
150 $this->height = round($destination->height / $ratio);
155 case File\Image::RESIZE_PROPORTIONAL_ALT:
156 case File\Image::RESIZE_PROPORTIONAL:
160 $width = max($this->width, $this->height);
161 $height = min($this->width, $this->height);
168 $ratioWidth = $destination->width /
$width;
169 $ratioHeight = $destination->height /
$height;
171 $ratio = min($ratioWidth, $ratioHeight);
174 if($ratio > 0 && $ratio < 1)
184 $destination->width = max(1, round($ratio * $this->width));
185 $destination->height = max(1, round($ratio * $this->height));