You are here

public function AbstractAutomatedCrop::setCropBoxSize in Automated Crop 8

Set crop box sizes.

The width & height of auto crop area must large than min sizes.

Parameters

int $width: The width of the crop area to be set.

int $height: The width of the crop area to be set.

Return value

self The plugin with two cropBox properties (width, height) set.

Overrides AutomatedCropInterface::setCropBoxSize

1 call to AbstractAutomatedCrop::setCropBoxSize()
AutomatedCropDefault::calculateCropBoxSize in src/Plugin/AutomatedCrop/AutomatedCropDefault.php
Calculation of the dimensions of the crop area.

File

src/AbstractAutomatedCrop.php, line 298

Class

AbstractAutomatedCrop
Provides a base class for each AutomatedCrop provider plugins.

Namespace

Drupal\automated_crop

Code

public function setCropBoxSize(int $width, int $height) {
  $this->cropBox['width'] = max($this->cropBox['min_width'], $width * $this->autoCropArea);
  $this->cropBox['height'] = max($this->cropBox['min_height'], $height * $this->autoCropArea);
  return $this;
}