Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resizeToCover, like in css? #131

Open
marcusdiy opened this issue Oct 22, 2020 · 0 comments
Open

resizeToCover, like in css? #131

marcusdiy opened this issue Oct 22, 2020 · 0 comments

Comments

@marcusdiy
Copy link

marcusdiy commented Oct 22, 2020

Q A
Bug report? no
Feature request? no
Usage question? yes
PHP version used 7.4

Hi, i was looking for a way to resize an image, without squashing it or blackbars, and to make sure that all the area should be cover. I found that there is a similar method called resizeToFit ...so maybe you could add another method in the same class. It would be resizeToCover, it should work just like the CSS cover attribute. What do you think?

    /**
     * Resize the layer to cover a bounding box by specifying pixel
     *
     * @param integer $width
     * @param integer $height
     * @param integer $positionX
     * @param integer $positionY
     * @param string $position
     */
    public function resizeToCover($width, $height, $px = 0, $py = 0, $position = 'MM')
    {
        $this->cropToAspectRatioInPixel($width, $height, $px, $py, $position);
        $this->resizeInPixel($width, $height);
        return $this;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant