You are here

public function AbstractAutomatedCrop::setOriginalSize in Automated Crop 8

Set the original sizes of image.

This method should also define the maximum size of the crop area to, ensure that the crop area does not exceed the original. If you want, to go beyond the original frame of the image redefine it.

Return value

self The plugin with originalImageSizes/maximum sizes property defined.

Overrides AutomatedCropInterface::setOriginalSize

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

File

src/AbstractAutomatedCrop.php, line 176

Class

AbstractAutomatedCrop
Provides a base class for each AutomatedCrop provider plugins.

Namespace

Drupal\automated_crop

Code

public function setOriginalSize() {
  $this->originalImageSizes['width'] = (int) $this->image
    ->getWidth();
  $this->originalImageSizes['height'] = (int) $this->image
    ->getHeight();

  // Store Max/Min limits of original image by default.
  if (empty($this->cropBox['max_width']) && empty($this->cropBox['max_height'])) {
    $this
      ->setMaxSizes($this->originalImageSizes['width'], $this->originalImageSizes['height']);
  }
  return $this;
}