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
@freekmurze Currently, a manipulation can only be used once because the method name is used as the array key.
I have a use case where I'm adding text to an image using a backdrop approach (similar to subtitles in early video formats) to ensure readability on both light and dark backgrounds.
Would you be open to a PR that tracks calls to each manipulation and generates indexed keys like text__0, text__1, etc.? The suffix would then be stripped before calling the actual manipulation method.
An alternative approach would be to allow the Manipulations class to be specified via a config file, enabling control of this behavior at the application level. Currently, we're unable to decorate it since it's not resolved through dependency injection.
Manipulations.php
public function __call(string $method, array $parameters): self
{
$this->addManipulation($method, $parameters);
return $this;
}
public function addManipulation(string $name, array $parameters = []): self
{
$this->manipulations[$name] = $parameters;
return $this;
}
public function apply(ImageDriver $image): void
{
foreach ($this->manipulations as $manipulationName => $parameters) {
$parameters = $this->transformParameters($manipulationName, $parameters);
$image->$manipulationName(...$parameters);
}
}
An alternative approach could be to have the Manipulation class coming from a config file in order to control the behaviour on application level. Currently we are not able to decorate it as it's not injected via dependency injection.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
@freekmurze Currently, a manipulation can only be used once because the method name is used as the array key.
I have a use case where I'm adding text to an image using a backdrop approach (similar to subtitles in early video formats) to ensure readability on both light and dark backgrounds.
Would you be open to a PR that tracks calls to each manipulation and generates indexed keys like text__0, text__1, etc.? The suffix would then be stripped before calling the actual manipulation method.
An alternative approach would be to allow the Manipulations class to be specified via a config file, enabling control of this behavior at the application level. Currently, we're unable to decorate it since it's not resolved through dependency injection.
Manipulations.php
An alternative approach could be to have the Manipulation class coming from a config file in order to control the behaviour on application level. Currently we are not able to decorate it as it's not injected via dependency injection.
Beta Was this translation helpful? Give feedback.
All reactions