Feature #41347
closedImageViewHelper: more flexible arguments
0%
Description
Many features of getImgResource are currently not available through the view helper. It is unlikely that all functionality can easily be offered. I propose to at least allow passing arbitrary arguments as done with the attached patch. Usage example which converts an image to grayscale and adjusts its brightness:
<f:image src="{image}" alt="" params="{ params: '-level 0%,100%,5.0 -colorspace Gray' }" />
One may consider limiting the implementation to only allow passing ImageMagick params, which would be fine for my use case and would lead to:
<f:image src="{image}" alt="" params="-level 0%,100%,5.0 -colorspace Gray" />
This would obviously disallow passing other additional arguments to getImgResource.
Files
Updated by Ingo Pfennigstorf about 12 years ago
Quite a lot new parameters, what about passing them as single parameter with an array?
Updated by Thomas Luzat about 12 years ago
Ingo Pfennigstorf wrote:
Quite a lot new parameters, what about passing them as single parameter with an array?
I can't see how this are quite a lot of parameters. The patch is just adding one single tag "params" (as used in the first usage example). My usage example might look confusing because the additional parameter passed to getImgResource in this example is named "params", too.
A more limiting implementation (which does not allow passing other arguments than "params" merged into the second parameter of getImgResource) would lead to a somewhat simpler syntax given in the second example:
<f:image src="{image}" alt="" params="-level 0%,100%,5.0 -colorspace Gray" />
This may be preferable if one cannot think of other use cases for this extension. A different implementation could also use an array:
<f:image src="{image}" alt="" params="{ '-level', '0%,100%,5.0', '-colorspace', 'Gray'}" />
This is complicated to type and there are probably few use cases where this is advantageous. As such I propose to implement either of the first two options (with my patch implementing the first option).
Updated by Ingo Pfennigstorf about 12 years ago
- Status changed from New to Accepted
- Target version set to 1910
Updated by Anja Leichsenring almost 12 years ago
- Project changed from 534 to 2559
- Category changed from 963 to Fluid: ViewHelpers
- Target version deleted (
1910)
Updated by Gerrit Code Review over 11 years ago
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21161
Updated by Thomas Luzat over 11 years ago
Gerrit Code Review wrote:
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21161
This patch set implements the more limiting option mentioned above (because of better usability) with "params" being replaced by "parameters".
Updated by Gerrit Code Review over 11 years ago
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21162
Updated by Sven Tappert over 10 years ago
Thomas, very nice idea.
It looks as if the ImageViewHelper has changed in the meantime (6.2.0beta6), so the key in the configuration array in the render() method now has to be 'additionalParameters' instead of 'params'. Otherwise it will not be recognized by the crop-scale-mask processing.
I implemented a custom ImageViewHelper, since it seems to take a while until this becomes part of the standard view helper.
Updated by Simon Schaufelberger over 10 years ago
this patch is actually really cool, i also want to see that in the core!
Updated by Gerrit Code Review over 10 years ago
- Status changed from Accepted to Under Review
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/21162
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/21162
Updated by Alexander Opitz about 10 years ago
- Project changed from 2559 to TYPO3 Core
- Category changed from Fluid: ViewHelpers to Fluid
Updated by Wouter Wolters over 9 years ago
- Status changed from Under Review to Closed
Will not be integrated in the core.
Updated by Felix Nagel over 9 years ago
Can we get a reason?
By the way: closing an issue with an existing patch without a reason is just rude.
Updated by Thomas Luzat over 9 years ago
There have been some comments within the patch sets.
Even if not wanted in core, the view helper should probably be extendable to (at least) allow modifying arguments instead of having to copy and patch the code. IIRC that is/was not possible, but I am too lazy to check or try further contributions.
The lack of speed when handling issues alone is too much of a hassle to get involved, but that should get a different issue #.
Updated by Rafal Brzeski over 7 years ago
If you want to have special effects on images you can use CSS property today,
just use simple CSS Filters, with pretty nice browsers support today http://caniuse.com/#feat=css-filters
Examples:
http://www.cssreflex.com/css-generators/filter/
https://css-tricks.com/almanac/properties/f/filter/