-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Add crop feature to media.image srcset #1096
base: development
Are you sure you want to change the base?
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
);
Meta note, if you enable https://github.com/blog/2247-improving-collaboration-with-forks we can fix cosmetics for you ;) |
Thank you. I enabled it. |
$treatIdAsReference = (boolean) $this->arguments['treatIdAsReference']; | ||
if (true === $treatIdAsReference) { | ||
$src = $this->arguments['src']; | ||
$crop = $this->arguments['crop']; | ||
if ($crop === null) { | ||
$crop = $src instanceof FileReference ? $src->getProperty('crop') : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We better import FileReference
Changes Unknown when pulling d650579 on muehle28:patch-1 into * on FluidTYPO3:development*. |
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
Crop feature for srcset pictures. Without this patch the srcset images are not rendered when a crop variable is set.