/**
  * 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);
 }
 /**
  * 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);
 }
 /**
  * @expectedException \LogicException
  * @expectedExceptionMessage Ratio have to be in the format of e.g. "1:1" or "16:9"
  * @test
  */
 public function testRatioException()
 {
     $this->service->getFocusWidthAndHeight(100, 100, '11');
 }