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

Missing the Fit::FillMax #3612

Closed
JelmerIJff opened this issue May 17, 2024 · 4 comments
Closed

Missing the Fit::FillMax #3612

JelmerIJff opened this issue May 17, 2024 · 4 comments
Assignees

Comments

@JelmerIJff
Copy link

JelmerIJff commented May 17, 2024

I'm missing the FillMax manipulation from the previous version.

I've tried Fit::Contain but then the image doesn't get my desired width and height. And with Fit::Fill the image stays really small with a lot of padding around it. FillMax is the perfect solution because that should respect the aspect ratio within the given desired width and height, and at the same time should upscale to fit the given width and height.

According to the docs it should work but there is no class present in the directory: https://spatie.be/docs/image/v3/image-manipulations/resizing-images#content-manipulationsfillmax

@timvandijck
Copy link
Member

There should be a way of doing this, but it's indeed not working the way it's documented.

You should try this:
->fit(fit: Fit::Fill, desiredWidth: 800, desiredHeight: 200, backgroundColor: '#0073ff')

I will update the documentation accordingly.

@JelmerIJff
Copy link
Author

No, i've already tried that but then you get a small image with a lot of padding around it. FillMax is supposed to fill it right to the edges right while maintaining the aspect ratio?
Team Visma Shirt

@timvandijck
Copy link
Member

Ok, tested it with some different images and sizes, and I think I see what you mean now.

I implemented a quick implementation in Imagick, but I'll only get around GD next week I'm afraid: spatie/image#258

@timvandijck
Copy link
Member

Pushed a new release of spatie/image that adds FillMax as a fit operation: spatie/image#258

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

2 participants