You are here

public function AbstractAutomatedCrop::setDelta in Automated Crop 8

Calculate and set the delta to apply of each size calculation of cropBox.

The delta are important to apply enlargement/reduction without loose, aspect ratio. This is the result of height divide by width (H / W) by, default this is calculated from the aspect ratio of image but you can, also calculate it like (originalImageHeight / OriginalImageWidth).

Return value

self AutomatedCrop plugin object.

Overrides AutomatedCropInterface::setDelta

1 call to AbstractAutomatedCrop::setDelta()
AbstractAutomatedCrop::initCropBox in src/AbstractAutomatedCrop.php
Initializes the properties of the plugins according to the configurations.

File

src/AbstractAutomatedCrop.php, line 230

Class

AbstractAutomatedCrop
Provides a base class for each AutomatedCrop provider plugins.

Namespace

Drupal\automated_crop

Code

public function setDelta() {
  $ratio = explode(':', $this
    ->getAspectRatio());
  $this->delta = (int) $ratio['1'] / (int) $ratio['0'];
  return $this;
}