예제 #1
0
 /**
  * @return array
  */
 protected function getConfiguration()
 {
     $configuration = $this->thumbnailService->getConfiguration();
     if (empty($configuration)) {
         $dimension = ImagePresetUtility::getInstance()->preset('image_thumbnail');
         $configuration = array('width' => $dimension->getWidth(), 'height' => $dimension->getHeight());
     }
     return $configuration;
 }
예제 #2
0
 /**
  * Returns preset values related to an image dimension
  *
  * @param string $preset
  * @param string $dimension
  * @return int
  */
 public function render($preset, $dimension = 'width')
 {
     $imageDimension = ImagePresetUtility::getInstance()->preset($preset);
     if ($dimension == 'width') {
         $result = $imageDimension->getWidth();
     } else {
         $result = $imageDimension->getHeight();
     }
     return $result;
 }
예제 #3
0
 /**
  * Returns a configurable thumbnail of an asset
  *
  * @throws \Exception
  * @return string
  */
 public function render()
 {
     $file = $this->arguments['file'];
     $preset = $this->arguments['preset'];
     $configuration = $this->arguments['configuration'];
     $configurationWrap = $this->arguments['configurationWrap'];
     $attributes = $this->arguments['attributes'];
     $output = $this->arguments['output'];
     if ($file instanceof Content) {
         $file = $this->getFileConverter()->convert($file);
     }
     if ($preset) {
         $imageDimension = ImagePresetUtility::getInstance()->preset($preset);
         $configuration['width'] = $imageDimension->getWidth();
         $configuration['height'] = $imageDimension->getHeight();
     }
     /** @var $thumbnailService \Fab\Media\Thumbnail\ThumbnailService */
     $thumbnailService = GeneralUtility::makeInstance('Fab\\Media\\Thumbnail\\ThumbnailService', $file);
     $thumbnail = $thumbnailService->setConfiguration($configuration)->setConfigurationWrap($configurationWrap)->setAttributes($attributes)->setOutputType($output)->create();
     return $thumbnail;
 }