/** * @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; }
/** * 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; }
/** * 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; }