Skip to content

Commit

Permalink
TASK: Thumbnail and Preview preset belong to Neos
Browse files Browse the repository at this point in the history
  • Loading branch information
dfeyer committed Dec 14, 2016
1 parent b4f4a1f commit b97140d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 15 deletions.
9 changes: 2 additions & 7 deletions Neos.Media.Browser/Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@

Neos:
Media:
thumbnailPresets:
'Neos.Media.Browser:Thumbnail':
maximumWidth: 250
maximumHeight: 250
'Neos.Media.Browser:Preview':
maximumWidth: 1000
maximumHeight: 1000
Browser:
bodyClasses: 'neos neos-module media-browser'
scripts:
Expand All @@ -26,6 +19,7 @@ Neos:
- 'resource://Neos.Media.Browser/Public/JavaScript/Modules/media-browser.js'
styles:
- 'resource://Neos.Neos/Public/Styles/Neos.css'

Flow:
security:
authentication:
Expand All @@ -40,6 +34,7 @@ Neos:
mvc:
routes:
'Neos.Media.Browser': true

Neos:
modules:
management:
Expand Down
4 changes: 2 additions & 2 deletions Neos.Media.Browser/Resources/Private/Partials/ListView.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<f:for each="{paginatedAssets}" as="asset" iteration="iterator">
<tr class="asset draggable-asset{f:if(condition: '{asset.tags -> f:count()} == 0', then: ' neos-media-untagged')}" data-asset-identifier="{asset -> f:format.identifier()}">
<td>
<div class="neos-list-thumbnail" data-neos-toggle="popover" data-placement="{f:if(condition: '{iterator.index} > 2', then: 'top', else: 'bottom')}" data-trigger="hover" data-title="{f:if(condition: asset.width, then: '{asset.width} x {asset.height}')}" data-html="true" data-content="{m:thumbnail(asset: asset, preset: 'Neos.Media.Browser:Thumbnail', alt: asset.label, async: settings.asyncThumbnails) -> f:format.htmlentities()}">
<m:thumbnail asset="{asset}" preset="Neos.Media.Browser:Thumbnail" alt="{asset.label}" async="{settings.asyncThumbnails}" />
<div class="neos-list-thumbnail" data-neos-toggle="popover" data-placement="{f:if(condition: '{iterator.index} > 2', then: 'top', else: 'bottom')}" data-trigger="hover" data-title="{f:if(condition: asset.width, then: '{asset.width} x {asset.height}')}" data-html="true" data-content="{m:thumbnail(asset: asset, preset: 'Neos.Neos:Thumbnail', alt: asset.label, async: settings.asyncThumbnails) -> f:format.htmlentities()}">
<m:thumbnail asset="{asset}" preset="Neos.Neos:Thumbnail" alt="{asset.label}" async="{settings.asyncThumbnails}" />
</div>
</td>
<td class="asset-label"><span data-neos-toggle="tooltip" title="{asset.label}"><f:format.crop maxCharacters="50">{asset.label}</f:format.crop></span></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<li class="asset">
<f:link.action action="edit" title="{neos:backend.translate(id: 'media.tooltip.editAsset', source: 'Modules', package: 'Neos.Neos')}" class="neos-thumbnail" arguments="{asset: asset}">
<div class="neos-img-container draggable-asset {f:if(condition: '{asset.tags -> f:count()} == 0', then: ' neos-media-untagged')}" data-asset-identifier="{asset -> f:format.identifier()}">
<m:thumbnail asset="{asset}" preset="Neos.Media.Browser:Thumbnail" alt="{asset.label}" async="{settings.asyncThumbnails}" />
<m:thumbnail asset="{asset}" preset="Neos.Neos:Thumbnail" alt="{asset.label}" async="{settings.asyncThumbnails}" />
</div>
</f:link.action>
<div class="neos-img-label">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<label>{neos:backend.translate(id: 'media.preview', source: 'Modules', package: 'Neos.Neos')}</label>
<div class="neos-preview-image">
<a href="{f:uri.resource(resource: asset.resource)}" target="_blank">
<m:thumbnail asset="{asset}" preset="Neos.Media.Browser:Preview" alt="{asset.label}" async="{settings.asyncThumbnails}" class="img-polaroid" />
<m:thumbnail asset="{asset}" preset="Neos.Neos:Preview" alt="{asset.label}" async="{settings.asyncThumbnails}" class="img-polaroid" />
</a>
</div>
</f:section>
Expand Down
4 changes: 2 additions & 2 deletions Neos.Neos/Classes/Controller/Backend/ContentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ protected function getImagePreviewData(Image $image)
],
'mediaType' => $image->getResource()->getMediaType()
];
$thumbnail = $this->thumbnailService->getThumbnail($image, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Media.Browser:Preview'));
$thumbnail = $this->thumbnailService->getThumbnail($image, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Neos:Preview'));
if ($thumbnail !== null) {
$imageProperties['previewImageResourceUri'] = $this->thumbnailService->getUriForThumbnail($thumbnail);
$imageProperties['previewDimensions'] = [
Expand Down Expand Up @@ -311,7 +311,7 @@ protected function getAssetProperties(Asset $asset)
'assetUuid' => $this->persistenceManager->getIdentifierByObject($asset),
'filename' => $asset->getResource()->getFilename()
];
$thumbnail = $this->thumbnailService->getThumbnail($asset, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Media.Browser:Thumbnail'));
$thumbnail = $this->thumbnailService->getThumbnail($asset, $this->thumbnailService->getThumbnailConfigurationForPreset('Neos.Neos:Thumbnail'));
if ($thumbnail !== null) {
$assetProperties['previewImageResourceUri'] = $this->thumbnailService->getUriForThumbnail($thumbnail);
$assetProperties['previewSize'] = ['w' => $thumbnail->getWidth(), 'h' => $thumbnail->getHeight()];
Expand Down
9 changes: 9 additions & 0 deletions Neos.Neos/Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,15 @@ Neos:
Neos.Rendering: Neos\Neos\Fusion\Helper\RenderingHelper
Neos.Caching: Neos\Neos\Fusion\Helper\CachingHelper

Media:
thumbnailPresets:
'Neos.Neos:Thumbnail':
maximumWidth: 250
maximumHeight: 250
'Neos.Neos:Preview':
maximumWidth: 1000
maximumHeight: 1000

Setup:
stepOrder:
- neosRequirements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h1>{neos:backend.translate(id: 'assets', value: 'Assets')}</h1>
<li class="asset">
<label class="asset-label">{asset.label}</label>
(<span class="asset-identifier">{asset.identifier}</span>)
<a rel="thumbnail" href="{media:uri.image(asset: asset, preset: 'Neos.Media.Browser:Thumbnail', async: asyncThumbnails)}">{neos:backend.translate(id: 'thumbnail', value: 'thumbnail')}</a>
<a rel="thumbnail" href="{media:uri.image(asset: asset, preset: 'Neos.Neos:Thumbnail', async: asyncThumbnails)}">{neos:backend.translate(id: 'thumbnail', value: 'thumbnail')}</a>
<f:link.action rel="asset-show" controller="Service\Assets" action="show" arguments="{identifier: asset.identifier}" format="html">{neos:backend.translate(id: 'show', value: 'show')}</f:link.action>
</li></f:for>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>{neos:backend.translate(id: 'asset', value: 'Asset')}: {asset.label}</h1>
<div class="asset">
<label class="asset-label">{asset.label}</label>
(<span class="asset-identifier">{asset.identifier}</span>)
<a rel="preview" href="{media:uri.image(asset: asset, preset: 'Neos.Media.Browser:Thumbnail', async: asyncThumbnails)}">{neos:backend.translate(id: 'preview', value: 'Preview')}</a>
<a rel="preview" href="{media:uri.image(asset: asset, preset: 'Neos.Neos:Thumbnail', async: asyncThumbnails)}">{neos:backend.translate(id: 'preview', value: 'Preview')}</a>
</div>
</div>
</body>
Expand Down

0 comments on commit b97140d

Please sign in to comment.