Exemple #1
0
 /**
  * Constructs the parameters for the cropper. Returns null when
  * the image should not be cropped.
  *
  * @param ImageInterface $image
  * @param FormatOptions $formatOptions
  * @param array $format
  *
  * @return array The crop parameters or null
  */
 private function getCropParameters(ImageInterface $image, $formatOptions, array $format)
 {
     if (isset($formatOptions)) {
         $parameters = ['x' => $formatOptions->getCropX(), 'y' => $formatOptions->getCropY(), 'width' => $formatOptions->getCropWidth(), 'height' => $formatOptions->getCropHeight()];
         if ($this->cropper->isValid($image, $parameters['x'], $parameters['y'], $parameters['width'], $parameters['height'], $format)) {
             return $parameters;
         }
     }
     return;
 }