You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also allow my users to select the area of main image from which thumbnail will be generated. User can select an area respecting thumbnail ratio or ignore that possibility. In twig I generate thumbnails as follows:
Problem with such option is that the new filter is merged to the original, which leads to situation where my additional crop filter is applied after creating of thumbnail, which is wrong (wrong in my use case to be clear).
leaving crop filter empty. In this case merge will apply my runtime config in correct order. However in this case I will receive an exception from image/box.php constructor that width and heigh can't be empty.
I can resolve the problem by commenting out that line
throw new InvalidArgumentException(sprintf('Length of either side cannot be 0 or negative, current size is %sx%s', $width, $height));
and then adding following lines to crop method
if (empty($width) && empty($height)) {
return $this;
}
Such approach allows me to create an optional crop filter, which will be ignored if no runtime config will be applied.
All in all I ask about a feature to set such optional filters out of the box to define order of filters which may be added later.
The text was updated successfully, but these errors were encountered:
My use case. I have got a simple thumbnail filter:
I also allow my users to select the area of main image from which thumbnail will be generated. User can select an area respecting thumbnail ratio or ignore that possibility. In twig I generate thumbnails as follows:
Problem with such option is that the new filter is merged to the original, which leads to situation where my additional crop filter is applied after creating of thumbnail, which is wrong (wrong in my use case to be clear).
I can change my config to something like that
leaving crop filter empty. In this case merge will apply my runtime config in correct order. However in this case I will receive an exception from
image/box.php
constructor thatwidth
andheigh
can't be empty.I can resolve the problem by commenting out that line
and then adding following lines to crop method
Such approach allows me to create an optional crop filter, which will be ignored if no runtime config will be applied.
All in all I ask about a feature to set such optional filters out of the box to define order of filters which may be added later.
The text was updated successfully, but these errors were encountered: