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

Resize facility cover image before upload #1106

Closed
wants to merge 1 commit into from

Conversation

khavinshankar
Copy link
Member

Proposed Changes

  • resize facility cover images before uploading to s3
  • set a maximum size limit of 1MB which is checked after resizing

Associated Issue

Architecture changes

  • nil

@coronasafe/code-reviewers

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete

@khavinshankar khavinshankar requested a review from a team as a code owner November 23, 2022 07:19
@codecov-commenter
Copy link

Codecov Report

Base: 55.89% // Head: 55.84% // Decreases project coverage by -0.04% ⚠️

Coverage data is based on head (fa144b6) compared to base (a640ef4).
Patch coverage: 26.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1106      +/-   ##
==========================================
- Coverage   55.89%   55.84%   -0.05%     
==========================================
  Files         175      175              
  Lines        8711     8727      +16     
  Branches     1475     1491      +16     
==========================================
+ Hits         4869     4874       +5     
- Misses       3790     3801      +11     
  Partials       52       52              
Impacted Files Coverage Δ
care/facility/api/serializers/facility.py 72.36% <21.42%> (-11.51%) ⬇️
config/settings/base.py 90.78% <100.00%> (+0.06%) ⬆️
care/users/api/viewsets/change_password.py 61.53% <0.00%> (+1.53%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

)

img = Image.open(image)
img.thumbnail((720, 720))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we only allow images of this ratio to be uploaded in the FE? ( Square ) Anything not in this ration would look weird right?

@@ -132,18 +135,41 @@ class Meta:
# Check DRYpermissions before updating
fields = ("cover_image", "read_cover_image_url")

def resize_image(self, image, image_extension="PNG"):
image_format = (
"JPEG" if image_extension.lower() == "jpg" else image_extension.upper()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we moving to uppercase?

@vigneshhari
Copy link
Member

This PR will be marked stale and closed within the next 2 days.

@gigincg
Copy link
Member

gigincg commented Apr 6, 2023

@khavinshankar

@sainak
Copy link
Member

sainak commented Jul 5, 2023

can we add a basic image tool to crop and resize the image, and then just check the size at the backend
@vigneshhari

@vigneshhari vigneshhari closed this Aug 8, 2023
@sainak sainak deleted the resize-facility-cover-image branch December 27, 2023 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compress/Resize Facility cover images
5 participants