-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImage.html
61 lines (55 loc) · 2.86 KB
/
Image.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:fc="http://typo3.org/ns/SMS/FluidComponents/ViewHelpers"
xmlns:ft="http://typo3.org/ns/Sitegeist/FluidTagbuilder/ViewHelpers"
xmlns:mvh="http://typo3.org/ns/Sitegeist/MediaComponents/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<fc:component>
<fc:param name="src" type="Sitegeist\MediaComponents\Domain\Model\ImageSource" />
<fc:param name="alt" type="string" optional="1" />
<fc:param name="title" type="string" optional="1" />
<f:comment><!-- Cropping --></f:comment>
<fc:param name="cropVariant" type="string" optional="1" />
<fc:param name="crop" type="Sitegeist\MediaComponents\Domain\Model\CropArea" optional="1" />
<f:comment><!-- Scaling --></f:comment>
<fc:param name="height" type="integer" optional="1" />
<fc:param name="width" type="integer" optional="1" />
<fc:param name="maxDimensions" type="boolean" optional="1" />
<fc:param name="srcset" type="Sitegeist\MediaComponents\Domain\Model\SourceSet" optional="1" />
<f:comment><!-- Delivery --></f:comment>
<fc:param name="sizes" type="string" optional="1" />
<fc:param name="format" type="string" optional="1" />
<fc:param name="lazyload" type="boolean" optional="1" />
<fc:param name="preload" type="boolean" optional="1" />
<fc:renderer>
<f:if condition="!{crop} && {cropVariant}">
<f:variable name="crop" value="{src -> mvh:image.cropVariant(name: cropVariant)}" />
</f:if>
<f:variable name="croppedImage" value="{src -> mvh:image.modify.format(format: format) -> mvh:image.modify.crop(crop: crop)}" />
<f:variable name="fallbackImage" value="{croppedImage -> mvh:image.modify.scale(height: height, width: width, maxDimensions: maxDimensions)}" />
<ft:img
src="{fallbackImage.publicUrl}"
srcset="{croppedImage -> mvh:image.srcset(srcset: srcset, base: fallbackImage)}"
height="{fallbackImage.height}"
width="{fallbackImage.width}"
alt="{f:if(condition: alt, then: alt, else: fallbackImage.alternative)}"
title="{f:if(condition: title, then: title, else: fallbackImage.title)}"
loading="{f:if(condition: lazyload, then: 'lazy')}"
sizes="{sizes}"
class="{class}"
/>
<f:if condition="{preload}">
<f:asset.css
identifier="{fallbackImage.publicUrl}"
type="{fallbackImage.originalImage.file.properties.mime_type}"
rel="preload"
as="image"
href="{fallbackImage.publicUrl}"
additionalAttributes="{imagesrcset: '{croppedImage -> mvh:image.srcset(srcset: srcset, base: fallbackImage)}', imagesizes: sizes}"
importance="high"
/>
</f:if>
</fc:renderer>
</fc:component>
</html>