[FEATURE] Add crop feature to media.image srcset#1096
Open
muehle28 wants to merge 6 commits into
Open
Conversation
Crop feature for srcset pictures. Without this patch the srcset images are not rendered when a crop variable is set.
Division by zero check when calculating ratio Wrap can be ignored when $treatIdAsReference=TRUE Height calculation can be ignored when height attribute is missing When $treatIdAsReference = FALSE the generation of the srcset images does not work. There is a problem when processed images are getting processed again. If $treatIdAsReference = TRUE the srcset images are getting processed from the original image. Therefore the crop and ratio information is needed.
When setting the quality attribute MathUtility was not found add use TYPO3\CMS\Core\Utility\MathUtility;
| } | ||
|
|
||
| $width = $width . $dimensions['postWidth']; | ||
| $srcsetVariant = $this->getImgResource($src, $width, $height, $format, $quality, $treatIdAsReference, $crop); |
Member
There was a problem hiding this comment.
Yes, I know that's super picky, but could you transform the call to a multi-line one? The code style still fails on checking it.
$this->getImgResource(
$src,
$width,
$height,
$format,
$quality,
$treatIdAsReference,
$crop
);
Member
|
Meta note, if you enable https://github.com/blog/2247-improving-collaboration-with-forks we can fix cosmetics for you ;) |
Author
|
Thank you. I enabled it. |
| $src = $this->arguments['src']; | ||
| $crop = $this->arguments['crop']; | ||
| if ($crop === null) { | ||
| $crop = $src instanceof FileReference ? $src->getProperty('crop') : null; |
Member
There was a problem hiding this comment.
We better import FileReference
|
Changes Unknown when pulling d650579 on muehle28:patch-1 into * on FluidTYPO3:development*. |
Member
|
getImgResource signature change is potentially breaking for other ViewHelpers using the trait - may not be exposed by unit tests either! |
|
Changes Unknown when pulling baefc77 on muehle28:patch-1 into * on FluidTYPO3:development*. |
92f48b6 to
0e4a73c
Compare
7b35850 to
50d769b
Compare
a834617 to
13ce63e
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Crop feature for srcset pictures. Without this patch the srcset images are not rendered when a crop variable is set.