/**
  * 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);
 }
Esempio n. 2
0
 /**
  * @param string $src
  * @param string $width
  * @param string $height
  * @param integer $minWidth
  * @param integer $minHeight
  * @param integer $maxWidth
  * @param integer $maxHeight
  * @param boolean $absolute
  */
 public function render($src, $width = NULL, $height = NULL, $minWidth = NULL, $minHeight = NULL, $maxWidth = NULL, $maxHeight = NULL, $absolute = FALSE)
 {
     $imageSource = parent::render($src, $width, $height, $minWidth, $minHeight, $maxWidth, $maxHeight);
     if ($absolute && TYPO3_MODE === 'FE') {
         $imageSource = $this->controllerContext->getRequest()->getBaseUri() . $imageSource;
     }
     return $imageSource;
 }
Esempio n. 3
0
 /**
  * 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')
 {
     if (GeneralUtility::compat_version('7.0')) {
         return self::renderStatic(['src' => $src, 'image' => $image, 'width' => $width, 'height' => $height, 'minWidth' => $minWidth, 'minHeight' => $minHeight, 'maxWidth' => $maxWidth, 'maxHeight' => $maxHeight, 'treatIdAsReference' => $treatIdAsReference, 'crop' => null, 'ratio' => $ratio], $this->buildRenderChildrenClosure(), $this->renderingContext);
     }
     /** @var \HDNET\Focuspoint\Service\FocusCropService $service */
     $service = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\FocusCropService');
     $src = $service->getCroppedImageSrcForViewHelper($src, $image, $treatIdAsReference, $ratio);
     return parent::render($src, null, $width, $height, $minWidth, $minHeight, $maxWidth, $maxHeight, false);
 }