Skip to content

Instantly share code, notes, and snippets.

@sebastiansommer
Created June 16, 2014 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastiansommer/2e3045ec9b90d072b96d to your computer and use it in GitHub Desktop.
Save sebastiansommer/2e3045ec9b90d072b96d to your computer and use it in GitHub Desktop.
Extends the image node type to use the original image
{namespace neos=TYPO3\Neos\ViewHelpers}
{namespace media=TYPO3\Media\ViewHelpers}
<figure{f:if(condition: imageClassName, then: ' class="{imageClassName}"')}>
<f:if condition="{image}">
<f:then>
<f:if condition="{link}">
<f:then>
<a href="{link}"><media:image asset="{image}" alt="{alternativeText}" title="{title}" maximumWidth="{maximumWidth}" maximumHeight="{maximumHeight}" allowCropping="{allowCropping
}" allowUpScaling="{allowUpScaling}" /></a>
</f:then>
<f:else>
<f:if condition="{useOrginal}">
<f:then>
<media:image asset="{image.originalImage}" alt="{alternativeText}" title="{title}" maximumWidth="{maximumWidth}" maximumHeight="{maximumHeight}" allowCropping="{allowCropping
}" allowUpScaling="{allowUpScaling}" />
</f:then>
<f:else>
<media:image asset="{image}" alt="{alternativeText}" title="{title}" maximumWidth="{maximumWidth}" maximumHeight="{maximumHeight}" allowCropping="{allowCropping
}" allowUpScaling="{allowUpScaling}" />
</f:else>
</f:if>
</f:else>
</f:if>
</f:then>
<f:else>
<f:security.ifAccess resource="TYPO3_Neos_Backend_GeneralAccess">
<f:if condition="{node.context.workspace.name} != 'live'">
<img src="{f:uri.resource(package: 'TYPO3.Neos', path: 'Images/dummy-image.png')}" title="Dummy image" alt="Dummy image" class="neos-handle" />
</f:if>
</f:security.ifAccess>
</f:else>
</f:if>
<f:if condition="{hasCaption}">
<figcaption>
{neos:contentElement.editable(property: 'caption', node: node)}
</figcaption>
</f:if>
</figure>
prototype(TYPO3.Neos.NodeTypes:Image) {
templatePath = 'resource://Fancy.Packge/Private/Templates/NodeTypes/Partials/Image.html'
}
'TYPO3.Neos.NodeTypes:Image':
properties:
useOrginal:
type: boolean
ui:
label: 'Use orginal image'
reloadIfChanged: TRUE
inspector:
group: 'image'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment