getThumbnailConfigurationForPreset() public méthode

public getThumbnailConfigurationForPreset ( string $preset, boolean $async = false ) : ThumbnailConfiguration
$preset string The preset identifier
$async boolean
Résultat Neos\Media\Domain\Model\ThumbnailConfiguration
 /**
  * @param AssetInterface $image
  * @return void
  */
 public function createThumbnails(AssetInterface $image)
 {
     if ($this->autoCreateThumbnailPresets) {
         foreach ($this->thumbnailService->getPresets() as $preset => $presetConfiguration) {
             $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $this->asyncThumbnails);
             $this->thumbnailService->getThumbnail($image, $thumbnailConfiguration);
         }
     }
 }
 /**
  * Renders the path to a thumbnail image, created from a given asset.
  *
  * @param AssetInterface $asset
  * @param integer $width Desired width of the thumbnail
  * @param integer $maximumWidth Desired maximum width of the thumbnail
  * @param integer $height Desired height of the thumbnail
  * @param integer $maximumHeight Desired maximum height of the thumbnail
  * @param boolean $allowCropping Whether the thumbnail should be cropped if the given sizes would hurt the aspect ratio
  * @param boolean $allowUpScaling Whether the resulting thumbnail size might exceed the size of the original asset
  * @param boolean $async Return asynchronous image URI in case the requested image does not exist already
  * @param string $preset Preset used to determine image configuration
  * @return string the relative thumbnail path, to be used as src attribute for <img /> tags
  */
 public function render(AssetInterface $asset = null, $width = null, $maximumWidth = null, $height = null, $maximumHeight = null, $allowCropping = false, $allowUpScaling = false, $async = false, $preset = null)
 {
     if ($preset) {
         $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $async);
     } else {
         $thumbnailConfiguration = new ThumbnailConfiguration($width, $maximumWidth, $height, $maximumHeight, $allowCropping, $allowUpScaling, $async);
     }
     return $this->assetService->getThumbnailUriAndSizeForAsset($asset, $thumbnailConfiguration, $this->controllerContext->getRequest())['src'];
 }
 /**
  * Renders an HTML img tag with a thumbnail image, created from a given asset.
  *
  * @param AssetInterface $asset The asset to be rendered as a thumbnail
  * @param integer $width Desired width of the thumbnail
  * @param integer $maximumWidth Desired maximum width of the thumbnail
  * @param integer $height Desired height of the thumbnail
  * @param integer $maximumHeight Desired maximum height of the thumbnail
  * @param boolean $allowCropping Whether the thumbnail should be cropped if the given sizes would hurt the aspect ratio
  * @param boolean $allowUpScaling Whether the resulting thumbnail size might exceed the size of the original asset
  * @param boolean $async Return asynchronous image URI in case the requested image does not exist already
  * @param string $preset Preset used to determine image configuration
  * @return string an <img...> html tag
  */
 public function render(AssetInterface $asset = null, $width = null, $maximumWidth = null, $height = null, $maximumHeight = null, $allowCropping = false, $allowUpScaling = false, $async = false, $preset = null)
 {
     if ($preset) {
         $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $async);
     } else {
         $thumbnailConfiguration = new ThumbnailConfiguration($width, $maximumWidth, $height, $maximumHeight, $allowCropping, $allowUpScaling, $async);
     }
     $thumbnailData = $this->assetService->getThumbnailUriAndSizeForAsset($asset, $thumbnailConfiguration, $this->controllerContext->getRequest());
     if ($thumbnailData === null) {
         return '';
     }
     $this->tag->addAttributes(array('width' => $thumbnailData['width'], 'height' => $thumbnailData['height'], 'src' => $thumbnailData['src']));
     return $this->tag->render();
 }
 /**
  * Remove thumbnails
  *
  * Removes all thumbnail objects and their resources. Optional ``preset`` parameter to only remove thumbnails
  * matching a specific thumbnail preset configuration.
  *
  * @param string $preset Preset name, if provided only thumbnails matching that preset are cleared
  * @return void
  */
 public function clearThumbnailsCommand($preset = null)
 {
     if ($preset !== null) {
         $thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset);
         $thumbnailConfigurationHash = $thumbnailConfiguration->getHash();
         $thumbnailCount = $this->thumbnailRepository->countByConfigurationHash($thumbnailConfigurationHash);
         $iterator = $this->thumbnailRepository->findAllIterator($thumbnailConfigurationHash);
     } else {
         $thumbnailCount = $this->thumbnailRepository->countAll();
         $iterator = $this->thumbnailRepository->findAllIterator();
     }
     $this->output->progressStart($thumbnailCount);
     foreach ($this->thumbnailRepository->iterate($iterator) as $thumbnail) {
         $this->thumbnailRepository->remove($thumbnail);
         $this->output->progressAdvance(1);
     }
 }
 /**
  * @param Asset $asset
  * @return array
  */
 protected function getAssetProperties(Asset $asset)
 {
     $assetProperties = ['assetUuid' => $this->persistenceManager->getIdentifierByObject($asset), 'filename' => $asset->getResource()->getFilename()];
     $thumbnail = $this->thumbnailService->getThumbnail($asset, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Media.Browser:Thumbnail'));
     if ($thumbnail !== null) {
         $assetProperties['previewImageResourceUri'] = $this->thumbnailService->getUriForThumbnail($thumbnail);
         $assetProperties['previewSize'] = ['w' => $thumbnail->getWidth(), 'h' => $thumbnail->getHeight()];
     }
     return $assetProperties;
 }