-
Notifications
You must be signed in to change notification settings - Fork 84
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
Lf 2200 allow the user to upload a custom image for the lf homepage background #2982
Lf 2200 allow the user to upload a custom image for the lf homepage background #2982
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure where to put the image related middleware so I kept it under the main middleware directory for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to change this to typescript to avoid errors when using inside FarmImagePicker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working great and it's so nice to see live! Thank you so much for this awesome contribution. I left a small comment, but other than that it looks good to go 🙂
Co-authored-by: Antonella Sgarlatta <[email protected]>
Good catch, I updated it and thanks for reviewing! |
Description
In the 'Farm info' form, an option to upload an image is added as well as to change or delete existing image. On successful form submission, image also appears on home page.
Jira link: https://lite-farm.atlassian.net/browse/LF-2200
Approach:
Initially, I attempted to follow a similar approach used for crop and document uploads (seperate from rest of the form, as discussed on slack) but ran into some issues with deleting the image that way. So I went with another approach where the image is sent along with rest of the form fields. Added benefit of this is that it reduces the amount of unnecessary images in storage in case users upload but don't submit.
Overview of changes:
For local testing, imaginary and minio services should be running and minio bucket should be set to public. In beta and production image requests will be sent to a cloudflare worker hosted at 'images.litefarm.workers.dev' that is responsible for authenticating the request and retrieving images from the private bucket.
Additional improvements to consider:
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist: