Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.93k stars 1.5k forks source link

"Missing argument" errors when using named arguments #1197

Closed HassanZahirnia closed 11 months ago

HassanZahirnia commented 1 year ago

Hey,

I recently started using named arguments in PHP and I noticed when I use them with functions such as widen(), I'd get the following errors:

Missing argument 1 for widen()

at vendor/intervention/image/src/Intervention/Image/Commands/Argument.php:71

Given this input:

$image->widen(
      width: 500,
      callback: fn ($constraint) => $constraint->upsize(),
);

It looks like there is a wrapper around the input which does not expect/support named arguments.

syntheticminds commented 1 year ago

Agreed. I would be nice to be able to do something like this:

$image->crop(
    x: $width * $area->left,
    y: $height * $area->top,
    width: $width * ($area->right - $area->left),
    height: $height * ($area->bottom - $area->top),
);
xavier-sanna commented 1 year ago

Same issue here image image image

olivervogel commented 11 months ago

Please use Version 3 of Intervention Image.