-
Notifications
You must be signed in to change notification settings - Fork 538
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
/fit-in not working with 4.0.0 #114
Comments
Hi @tjw0051 we faced a similar issue. That's because they aren't passing anything to resize. This is how we did in thumbor: https://<our_cf_url>/fit-in/500x500/filters:quality(90):fill(fff)/my_source.jpg If we use 'inside', we get back an image with aspect ratio maintained, but we aren't able to fill it with white color so as to get back 500x500 final product. options.background can only be used with 'contain'. So, if this was instead using this.edits.resize.fit = 'contain', we could pass sharp(input) |
This is what we did to make /fit-in/ work: #130 Also includes fixes to make fetching from S3 sub directories work. Although this pasts the unit-test, this is what works with our use cases, use at your own risk. |
We have updated our solution, and I believe your issue has been fixed. If you still see the issue with the latest version (v4.2), please feel free to reopen the issue. You can refer to the recent changes here |
@beomseoklee @georgebearden hi! I've updated the function on a project and noticed this change. Is there a way to update the urls to use the old |
If anyone else wants the same I did, apparently it's possible to do that changing the line 59 of |
Using
/fit-in/AxB/
is cropping images rather than fitting them within the dimensions specified.Example: https://i1rk6c9qi5.execute-api.us-east-1.amazonaws.com/image/100x100/bart.png
A workaround to fit an image into the resize area is to use the upscale filter:
https://i1rk6c9qi5.execute-api.us-east-1.amazonaws.com/image/200x50/filters:upscale()/bart.png
The fix for this might be in the
process(event)
function:https://github.com/awslabs/serverless-image-handler/blob/a1b3eb659807599eaec88fb8df21bc34a45b93ee/source/image-handler/thumbor-mapping.js#L27-L38
... the
this.edits.resize.fit = 'inside'
needs to be set, the same as what happens in theupscale()
filter.The text was updated successfully, but these errors were encountered: