public function getSelectArea(ImageInterface $image)
{
if ($this->isCrop()) {
$cropSpecs = explode('_', $this->getSpecs());
if (count($cropSpecs) > 1) {
array_shift($cropSpecs);
return $cropSpecs;
}
}
$ratio = min($image->getWidth() / (double) $this->width, $image->getHeight() / (double) $this->height);
$width = (int) round($ratio * $this->width);
$height = (int) round($ratio * $this->height);
$minx = (int) round(($image->getWidth() - $width) / 2);
$miny = (int) round(($image->getHeight() - $height) / 2);
return array($minx, $miny, $minx + $width, $miny + $height);
}