Skip to content

Commit

Permalink
New: Add quality option
Browse files Browse the repository at this point in the history
 Needs sitegeist/Sitegeist.Kaleidoscope#75 merged and released
  • Loading branch information
jonnitto committed Jan 28, 2024
1 parent 3a1d38b commit aabd1c0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Configuration/Settings.Carbon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Carbon:
imageFormat:
default: webp
additional: []
# Needs https://github.com/sitegeist/Sitegeist.Kaleidoscope/pull/75 merged and released
quality: null
lazy:
enabled: false
lazyWidth: null
Expand Down Expand Up @@ -41,3 +43,5 @@ Carbon:
width: null
height: null
imageFormat: webp
# Needs https://github.com/sitegeist/Sitegeist.Kaleidoscope/pull/75 merged and released
quality: null
4 changes: 4 additions & 0 deletions Resources/Private/Fusion/Helper/BasisPresentation.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ prototype(Carbon.Image:Helper.BasisPresentation) < prototype(Neos.Fusion:Compone
variantPreset = ${PropTypes.arrayOf(PropTypes.string)}
width = ${PropTypes.float}
height = ${PropTypes.float}
quality = ${PropTypes.float}
additionalFormats = ${PropTypes.arrayOf(PropTypes.string)}
}

Expand All @@ -17,6 +18,8 @@ prototype(Carbon.Image:Helper.BasisPresentation) < prototype(Neos.Fusion:Compone
lazyClass = ${Configuration.Setting('Carbon.Image.lazy.class')}
lazyWidth = ${Configuration.Setting('Carbon.Image.lazy.lazyWidth')}

quality = ${Configuration.Setting('Carbon.Image.quality')}

imageSource = ${null}
thumbnailPreset = ${null}
variantPreset = ${null}
Expand Down Expand Up @@ -66,6 +69,7 @@ prototype(Carbon.Image:Helper.BasisPresentation) < prototype(Neos.Fusion:Compone
sizedImageSource.@process {
width = ${private.isScalableImageSource && props.width ? value.withWidth(props.width) : value}
height = ${private.isScalableImageSource && props.height ? value.withHeight(props.height) : value}
quality = ${private.isScalableImageSource && props.quality ? value.withQuality(props.quality) : value}
variantPreset = ${private.isScalableImageSource && props.variantPreset ? value.withVariantPreset(props.variantPreset[0], props.variantPreset[1]) : value}
}
imageClass = ${BEM.modifier('carbon-image', [props.objectFit, 'picture'])}
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Fusion/Helper/ImageSource.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ prototype(Carbon.Image:Helper.ImageSource) < prototype(Neos.Fusion:Component) {
format = ${PropTypes.string}
width = ${PropTypes.float}
height = ${PropTypes.float}
quality = ${PropTypes.float}
outputDummy = ${PropTypes.boolean}
forceDummy = ${PropTypes.boolean}
dummyForgroundColor = ${PropTypes.string}
Expand Down Expand Up @@ -52,6 +53,7 @@ prototype(Carbon.Image:Helper.ImageSource) < prototype(Neos.Fusion:Component) {
format = ${props.format}
width = ${props.width}
height = ${props.height}
quality = ${props.quality}
}
}
isImageSource {
Expand All @@ -63,6 +65,7 @@ prototype(Carbon.Image:Helper.ImageSource) < prototype(Neos.Fusion:Component) {
format = ${props.format ? value.withFormat(props.format) : value}
width = ${props.width ? value.withWidth(props.width) : value}
height = ${props.height ? value.withHeight(props.height) : value}
quality = ${props.quality ? value.withQuality(props.quality) : value}
}
}
isResource {
Expand Down
1 change: 1 addition & 0 deletions Resources/Private/Fusion/Helper/Link/Attributes.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ prototype(Carbon.Image:Helper.Link.Attributes) < prototype(Neos.Fusion:Component
width = ${props.lightboxConfiguration.width || null}
height = ${props.lightboxConfiguration.height || null}
imageFormat = ${props.lightboxConfiguration.imageFormat || null}
quality = ${props.lightboxConfiguration.quality || null}
}

srcset = Carbon.Image:Helper.MinMaxImageSize {
Expand Down

0 comments on commit aabd1c0

Please sign in to comment.