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

Image will not manipulate when using crop focus zoom and when resize dimensions are equal to original asset dimensions #362

Closed ncla closed 1 year ago

ncla commented 1 year ago

League\Glide\Manipulators\Size has the following code currently:

    public function run(Image $image)
    {
        # ...
        if ((int) $width !== (int) $image->width() or (int) $height !== (int) $image->height()) {
            $image = $this->runResize($image, $fit, (int) $width, (int) $height);
        }

        return $image;
    }

This check makes sense for other resize types, but when using the zoom value in crop focal point mode (with values such as 82-39-4.4), the zoom will be ignored and resize operation will not happen, as the resize width/height is the same as source image.

This is kinda niche bug but I did stumble upon it in Statamic addon which utilizes crop focal points.

I am up for making a PR with a fix for this.