Combining cropper.js and Spatie image - want to retain a square cropped transparent PNG - but it keeps getting zoomed-in or white BG added #310
Unanswered
peterbournecommunications
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a cropper.js instance that successfully send an image up my app in Laravel. I then use Spatie to crop the image and save.
When I was cropping normal images - and constrained the "view mode" in Cropper.js - the images were creating, resizing and saving fine.
But for logos I wanted people to be able to zoom out, centre their logo and then crop/Save/Upload it. Whilst maintain g a square finished file size - so all the logos would align in various views (carousels etc).
My Spatie resize/save code was simple:
With the crop regions provided by cropper.js etc. and $this->finalWidth and Height being specified as 600px each elsewhere.
I can't show examples of the resulting images here, sadly. But any changing of fit to fit(Fit::Fill... or Fit::Constrain fails - with ugly white background.
Is there an option that would achieve what I want - or do I need to approach in a different way, please?
Beta Was this translation helpful? Give feedback.
All reactions