private function _crop()
{
$this->cropratio = explode(':', $this->cropratio);
if (count($this->cropratio) == 2) {
$this->ratioComputed = $this->width / $this->height;
$this->cropRatioComputed = (double) $this->cropratio[0] / (double) $this->cropratio[1];
if ($this->ratioComputed < $this->cropRatioComputed) {
// Image is too tall so we will crop the top and bottom
$this->origHeight = $this->height;
$this->height = $this->width / $this->cropRatioComputed;
$this->offsetY = ($this->origHeight - $this->height) / 2;
} else {
if ($this->ratioComputed > $this->cropRatioComputed) {
// Image is too wide so we will crop off the left and right sides
$this->origWidth = $this->width;
$this->width = $this->height * $this->cropRatioComputed;
$this->offsetX = ($this->origWidth - $this->width) / 2;
}
}
}
}