You are here

public function AutomatedCropDefault::calculateCropBoxCoordinates in Automated Crop 8

Calculation of the coordinates of the crop area.

This method allow you to define a specific logic to calculate, the position of the top left corner of crop area.

Return value

self AutomatedCrop plugin with the coordinates set.

Overrides AbstractAutomatedCrop::calculateCropBoxCoordinates

See also

\Drupal\automated_crop\Plugin\AutomatedCrop\AutomatedCropDefault

File

src/Plugin/AutomatedCrop/AutomatedCropDefault.php, line 21

Class

AutomatedCropDefault
Class Generic routing entity mapper.

Namespace

Drupal\automated_crop\Plugin\AutomatedCrop

Code

public function calculateCropBoxCoordinates() {
  $this->cropBox['x'] = $this->originalImageSizes['width'] / 2 - $this->cropBox['width'] / 2;
  $this->cropBox['y'] = $this->originalImageSizes['height'] / 2 - $this->cropBox['height'] / 2;
  return $this;
}