vhs icon indicating copy to clipboard operation
vhs copied to clipboard

v:uri.image cropVariant

Open nimbux2000 opened this issue 6 years ago • 4 comments

I using v:uri.image to create responsive image tags and lazy loading the different image scoures depening on resolution and pixel density. Each image has its own resolution and quality setting. Now i started my first Typo3 8.7 project and its not possible to use new image manipulation over cropVariant. I now use f:uri.image but this at the other hand has no quality settings.

Have you any plans to implement cropVariant into vhs?

nimbux2000 avatar Nov 16 '17 16:11 nimbux2000

Supporting cropVariants should be as easy as adding the attribute cropVariant to the ViewHelper and passing it to the $setup array. The rest is handled by the TYPO3 core. Please consider adding this.

https://github.com/FluidTYPO3/vhs/blob/d14d9d1584d6267a18678170a8f0feb3679a6293/Classes/ViewHelpers/Media/Image/AbstractImageViewHelper.php#L156-L165

public function initializeArguments() {
    // [...]
    $this->registerArgument(
        'cropVariant',
        'string',
        'Use crop variant if set.',
        false,
        'default'
    );
}
$setup = [ 
    // [...]
    'cropVariant' => $this->arguments['cropVariant'] ?: 'default'
]; 

maechler avatar Oct 19 '18 10:10 maechler

Shouldn't this also be added to the v:media.source viewhelper? The v:media.souce is used withig a v:media.picture in the example given in the VHS documentation.

rowild avatar Jan 25 '19 10:01 rowild

Also in v:media.image?

yeldiRium avatar Mar 27 '19 14:03 yeldiRium

@yeldiRium As far as I can see the class ImageViewHelper extends AbstractImageViewHelper, thus it should be covered by adding it to AbstractImageViewHelper.

Adding it to SourceViewHelper however seems to be necessary as @rowild pointed out.

maechler avatar Mar 27 '19 14:03 maechler