How to crop from the top to desired width and height? #319
Unanswered
martinbean
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have recently updated from
spatie/laravel-medialibrary, which changed fromspatie/imageversion 2 to 3, and thumbnails for newly-uploaded images look awful.The issue is around cropping. I want to crop an image from the top, fitting it to a given width and height. This was working with the following:
But it seems now images aren’t resized before cropping, so a 920×518 “window” is literally cropped from the full-sized image, rather than given me a nicely-resized thumbnail cropped to be those dimensions.
I’ve tried multiple combinations and permutations of resizing, filling, cropping, and just can’t get the result I want. The biggest issue is
fithas no, “cover these dimensions” that I can then chain a crop on the end to crop from the top with no wasted space. I either get an image that’s the wrong dimensions if the image isn’t the exact aspect ratio as the desired thumbnail, or I can crop but only from the centre.Can someone please tell me what method(s) I should be using? As I’m just getting frustrated now.
Beta Was this translation helpful? Give feedback.
All reactions