-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Only output existing images and allow upscaling
- Loading branch information
1 parent
83b512e
commit 66bab25
Showing
7 changed files
with
131 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,15 +126,18 @@ prototype(Sitegeist.Kaleidoscope:Image) < prototype(Neos.Fusion:Component) { | |
format = null | ||
attributes = Neos.Fusion:DataStructure | ||
renderDimensionAttributes = true | ||
allowSrcsetUpScaling = false | ||
preserveAspect = true | ||
|
||
renderer = Neos.Fusion:Component { | ||
@if.hasImageSource = ${props.imageSource && Type.instance(props.imageSource, '\\Sitegeist\\Kaleidoscope\\Domain\\ImageSourceInterface')} | ||
isScalableSource = ${props.imageSource && Type.instance(props.imageSource, '\\Sitegeist\\Kaleidoscope\\Domain\\ScalableImageSourceInterface')} | ||
|
||
# apply format, width and height to the imageSource | ||
imageSource = ${props.imageSource} | ||
[email protected] = ${props.width ? value.withWidth(props.width) : value} | ||
[email protected] = ${props.height ? value.withHeight(props.height) : value} | ||
[email protected] = ${(props.width && props.height) ? value.withDimensions(props.width, props.height) : value} | ||
[email protected] = ${(props.width && !props.height) ? value.withWidth(props.width, props.preserveAspect) : value} | ||
[email protected] = ${(props.height && !props.width) ? value.withHeight(props.height, props.preserveAspect) : value} | ||
[email protected] = ${props.format ? value.withFormat(props.format) : value} | ||
|
||
srcset = ${props.srcset} | ||
|
@@ -145,11 +148,12 @@ prototype(Sitegeist.Kaleidoscope:Image) < prototype(Neos.Fusion:Component) { | |
class = ${props.class} | ||
attributes = ${props.attributes} | ||
renderDimensionAttributes = ${props.renderDimensionAttributes} | ||
allowSrcsetUpScaling = ${props.allowSrcsetUpScaling} | ||
|
||
renderer = afx` | ||
<img | ||
src={props.imageSource.src()} | ||
srcset={props.imageSource.srcset(props.srcset)} | ||
srcset={props.imageSource.srcset(props.srcset, props.allowSrcsetUpScaling)} | ||
[email protected]={props.isScalableSource && props.srcset} | ||
sizes={props.sizes} | ||
[email protected]={props.isScalableSource && props.sizes} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ prototype(Sitegeist.Kaleidoscope:Picture) < prototype(Neos.Fusion:Component) { | |
imgAttributes = Neos.Fusion:DataStructure | ||
content = '' | ||
renderDimensionAttributes = true | ||
allowSrcsetUpScaling = false | ||
preserveAspect = true | ||
|
||
# | ||
# put the values that shall be applied to sources automatically to the context | ||
|
@@ -83,9 +85,10 @@ prototype(Sitegeist.Kaleidoscope:Picture) < prototype(Neos.Fusion:Component) { | |
|
||
# apply format, width and height to the imageSource | ||
imageSource = ${props.imageSource} | ||
[email protected] = ${props.width ? value.setWidth(props.width) : value} | ||
[email protected] = ${props.height ? value.setHeight(props.height) : value} | ||
[email protected] = ${props.format ? value.setFormat(props.format) : value} | ||
[email protected] = ${(props.width && props.height) ? value.withDimensions(props.width, props.height) : value} | ||
[email protected] = ${(props.width && !props.height) ? value.withWidth(props.width, props.preserveAspect) : value} | ||
[email protected] = ${(props.height && !props.width) ? value.withHeight(props.height, props.preserveAspect) : value} | ||
[email protected] = ${props.format ? value.withFormat(props.format) : value} | ||
|
||
srcset = ${props.srcset} | ||
sizes = ${props.sizes} | ||
|
@@ -99,6 +102,8 @@ prototype(Sitegeist.Kaleidoscope:Picture) < prototype(Neos.Fusion:Component) { | |
imgAttributes = ${props.imgAttributes} | ||
content = ${props.content} | ||
renderDimensionAttributes = ${props.renderDimensionAttributes} | ||
allowSrcsetUpscaling = ${props.allowSrcsetUpscaling} | ||
preserveAspect = ${props.preserveAspect} | ||
|
||
renderer = afx` | ||
<picture class={props.class} {...props.attributes}> | ||
|
@@ -114,6 +119,8 @@ prototype(Sitegeist.Kaleidoscope:Picture) < prototype(Neos.Fusion:Component) { | |
srcset={source.srcset ? source.srcset : props.srcset} | ||
sizes={source.sizes ? source.sizes : props.sizes} | ||
renderDimensionAttributes={props.renderDimensionAttributes} | ||
allowSrcsetUpScaling={props.allowSrcsetUpScaling} | ||
preserveAspect={props.preserveAspect} | ||
/> | ||
</Neos.Fusion:Collection> | ||
<Neos.Fusion:Collection | ||
|
@@ -135,6 +142,7 @@ prototype(Sitegeist.Kaleidoscope:Picture) < prototype(Neos.Fusion:Component) { | |
title={props.title} | ||
attributes={props.imgAttributes} | ||
renderDimensionAttributes={props.renderDimensionAttributes} | ||
preserveAspect={props.preserveAspect} | ||
/> | ||
</picture> | ||
` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ prototype(Sitegeist.Kaleidoscope:Source) < prototype(Neos.Fusion:Component) { | |
type = null | ||
media = null | ||
renderDimensionAttributes = true | ||
allowSrcsetUpScaling = false | ||
preserveAspect = true | ||
|
||
renderer = Neos.Fusion:Component { | ||
|
||
|
@@ -29,19 +31,21 @@ prototype(Sitegeist.Kaleidoscope:Source) < prototype(Neos.Fusion:Component) { | |
isScalableSource = ${imageSource && Type.instance(imageSource, '\\Sitegeist\\Kaleidoscope\\Domain\\ScalableImageSourceInterface')} | ||
|
||
imageSource = ${imageSource} | ||
[email protected] = ${width ? value.withWidth(width) : value} | ||
[email protected] = ${height ? value.withHeight(height) : value} | ||
[email protected] = ${format ? value.withFormat(format) : value} | ||
[email protected] = ${(props.width && props.height) ? value.withDimensions(props.width, props.height) : value} | ||
[email protected] = ${(props.width && !props.height) ? value.withWidth(props.width, props.preserveAspect) : value} | ||
[email protected] = ${(props.height && !props.width) ? value.withHeight(props.height, props.preserveAspect) : value} | ||
[email protected] = ${props.format ? value.withFormat(props.format) : value} | ||
|
||
type = ${format ? 'image/' + format : props.type} | ||
srcset = ${srcset} | ||
sizes = ${sizes} | ||
media = ${props.media} | ||
renderDimensionAttributes = ${props.renderDimensionAttributes} | ||
allowSrcsetUpScaling = ${props.allowSrcsetUpScaling} | ||
|
||
renderer = afx` | ||
<source @if.has={props.imageSource} | ||
srcset={props.imageSource.srcset(props.srcset)} | ||
srcset={props.imageSource.srcset(props.srcset, props.allowSrcsetUpScaling)} | ||
sizes={props.sizes} | ||
[email protected]={props.sizes && props.isScalableSource} | ||
[email protected]={Type.isArray(value) ? Array.join(value, ', ') : value} | ||
|