/**
  * Processing the focus point crop (fallback to LocalCropScaleMaskHelper)
  *
  * @param TaskInterface $task
  *
  * @return array|NULL
  */
 public function process(TaskInterface $task)
 {
     $configuration = $task->getConfiguration();
     $crop = $configuration['crop'] ? json_decode($configuration['crop']) : null;
     if ($crop instanceof \stdClass && isset($crop->x)) {
         // if crop is enable release the process
         return parent::process($task);
     }
     $sourceFile = $task->getSourceFile();
     try {
         if (self::$deepCheck === false) {
             self::$deepCheck = true;
             $ratio = $this->getCurrentRatioConfiguration();
             $this->dimensionService->getRatio($ratio);
             $newFile = $this->focusCropService->getCroppedImageSrcByFile($sourceFile, $ratio);
             $file = ResourceFactory::getInstance()->retrieveFileOrFolderObject($newFile);
             $targetFile = $task->getTargetFile();
             ObjectAccess::setProperty($targetFile, 'originalFile', $file, true);
             ObjectAccess::setProperty($targetFile, 'originalFileSha1', $file->getSha1(), true);
             ObjectAccess::setProperty($targetFile, 'storage', $file->getStorage(), true);
             ObjectAccess::setProperty($task, 'sourceFile', $file, true);
             ObjectAccess::setProperty($task, 'targetFile', $targetFile, true);
         }
     } catch (\Exception $ex) {
     }
     self::$deepCheck = false;
     return parent::process($task);
 }
 /**
  * Resize the image (if required) and returns its path. If the image was not changed, the path will be equal to $src
  *
  * @see http://typo3.org/documentation/document-library/references/doc_core_tsref/4.2.0/view/1/5/#id4164427
  *
  * @param string                           $src
  * @param FileInterface|AbstractFileFolder $image
  * @param string                           $width              width of the image. This can be a numeric value representing the fixed width of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
  * @param string                           $height             height of the image. This can be a numeric value representing the fixed height of the image in pixels. But you can also perform simple calculations by adding "m" or "c" to the value. See imgResource.width for possible options.
  * @param integer                          $minWidth           minimum width of the image
  * @param integer                          $minHeight          minimum height of the image
  * @param integer                          $maxWidth           maximum width of the image
  * @param integer                          $maxHeight          maximum height of the image
  * @param boolean                          $treatIdAsReference given src argument is a sys_file_reference record
  * @param string                           $ratio
  *
  * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
  * @return string path to the image
  */
 public function render($src = null, $image = null, $width = null, $height = null, $minWidth = null, $minHeight = null, $maxWidth = null, $maxHeight = null, $treatIdAsReference = false, $ratio = '1:1')
 {
     $internalImage = $this->getImage($src, $treatIdAsReference);
     $service = new FocusCropService();
     $src = $service->getCroppedImageSrcByFile($internalImage, $ratio);
     return parent::render($src, null, $width, $height, $minWidth, $minHeight, $maxWidth, $maxHeight, false);
 }
 /**
  * Processing the focus point crop (fallback to LocalCropScaleMaskHelper)
  *
  * @param TaskInterface $task
  *
  * @return array|NULL
  */
 public function process(TaskInterface $task)
 {
     $sourceFile = $task->getSourceFile();
     try {
         $ratio = $this->getCurrentRatioConfiguration();
         $this->dimensionService->getRatio($ratio);
         $newFile = $this->focusCropService->getCroppedImageSrcByFile($sourceFile, $ratio);
         $file = ResourceFactory::getInstance()->retrieveFileOrFolderObject($newFile);
         $targetFile = $task->getTargetFile();
         ObjectAccess::setProperty($targetFile, 'originalFile', $file, TRUE);
         ObjectAccess::setProperty($targetFile, 'originalFileSha1', $file->getSha1(), TRUE);
         ObjectAccess::setProperty($targetFile, 'storage', $file->getStorage(), TRUE);
         ObjectAccess::setProperty($task, 'sourceFile', $file, TRUE);
         ObjectAccess::setProperty($task, 'targetFile', $targetFile, TRUE);
     } catch (\Exception $ex) {
     }
     return parent::process($task);
 }