thephpleague / glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.
http://glide.thephpleague.com
MIT License
2.54k stars 198 forks source link

Differences in the use of fit=fill and fit=fill-max #385

Closed Art4 closed 6 months ago

Art4 commented 6 months ago

I've noted differences between Glide v2 and v3 using the fit=fill and fit=fill-max manipulators. I'm using my own diff tool: https://gist.github.com/Art4/95c476dc8aa42e8668db792c03e103e1

grafik grafik

Result from Glide v2

Unbenannt

Result from Glide v3

Unbenannt

With Glide v3 the image is 1 pixel wider, or the white border on the left-hand side is 1 pixel thinner.

I'm not sure where the problem lies and whether this difference is even worth fixing.

ADmad commented 6 months ago

Earlier fit and fill-max used a 2 step operation of resizing the image and then resizing the canvas. Now they are just proxies to intervention's pad() and contain(). The difference might be due to some change in intervention's calculation of dimensions. I don't think this is an issue.

Art4 commented 6 months ago

I've checked all examples from the v2 docs and can confirm that everything (except this issue) works as before.

There are also cases like filt=sepia, bri=-25 or bri=50, where I get deprecated warnings in intervention/image v2 and PHP 8.3, like this:

Deprecated: Implicit conversion from float 127.49999999999999 to int loses precision in vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php on line 19

But these problems are fixed with v3.

ADmad commented 6 months ago

Thanks for testing out the various manipulations.

I did improve the typing in Glide v3 too. I thought of enabling strict typing too (intervention v3 has done it) but given that we have a lot of numeric argument string vs int isn't strictly followed so left that for now.