Newscoop\Image\Rendition::getSelectArea PHP Метод

getSelectArea() публичный Метод

Get select area
public getSelectArea ( Newscoop\Image\ImageInterface $image ) : array
$image Newscoop\Image\ImageInterface
Результат array
    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);
    }

Usage Example

 public function getSelectArea(\Newscoop\Image\ImageInterface $image)
 {
     $this->__load();
     return parent::getSelectArea($image);
 }