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

[Waste] Limit image size on Echo backed Bulky Collection reports. #4939

Merged
merged 1 commit into from May 7, 2024

Conversation

neprune
Copy link
Contributor

@neprune neprune commented Apr 26, 2024

[skip changelog]

closes https://github.com/mysociety/societyworks/issues/4243

mysoc-servers branch: gh-4243.

Verified on staging with a load of 4.7MB 2048x2048 jpegs: https://bromley.staging.fixmystreet.com/admin/report_edit/24439.

Copy link

codecov bot commented Apr 26, 2024

Codecov Report

Attention: Patch coverage is 31.42857% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 82.66%. Comparing base (3adcce8) to head (49b1501).

❗ Current head 49b1501 differs from pull request most recent head 4afb9b8. Consider uploading reports for the commit 4afb9b8 to get more accurate results

Files Patch % Lines
perllib/FixMyStreet/App/Model/PhotoSet.pm 0.00% 17 Missing ⚠️
perllib/FixMyStreet/Roles/CobrandEcho.pm 66.66% 0 Missing and 5 partials ⚠️
perllib/FixMyStreet/ImageMagick.pm 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4939      +/-   ##
==========================================
+ Coverage   82.61%   82.66%   +0.04%     
==========================================
  Files         391      392       +1     
  Lines       30488    30749     +261     
  Branches     4813     4868      +55     
==========================================
+ Hits        25189    25419     +230     
- Misses       3865     3887      +22     
- Partials     1434     1443       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@neprune neprune force-pushed the gh-4243 branch 7 times, most recently from 83334e1 to 93c1c49 Compare April 29, 2024 15:26
@neprune neprune requested a review from dracos April 29, 2024 16:20
@neprune
Copy link
Contributor Author

neprune commented Apr 29, 2024

@dracos I still need to write tests for some coverage but sharing in case you have an early feedback.

@neprune neprune force-pushed the gh-4243 branch 2 times, most recently from 8936ab4 to ee065c8 Compare April 30, 2024 20:03
@neprune
Copy link
Contributor Author

neprune commented May 1, 2024

@dracos Added some tests now, ready for review.

Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

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

A few small suggestions is all :)

perllib/FixMyStreet/ImageMagick.pm Outdated Show resolved Hide resolved
my @images = $self->all_ids;
foreach my $i (0.. $#images) {
my $blob = $self->get_raw_image($i)->{data};
while (length $blob > $size_bytes) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we multiple $resize_percent by itself each loop, and always shrink from the full size image? Just worried that repeated shrinkings might degrade the quality of the image as opposed to one shrinking (of whatever %).

Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

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

Thanks :)

@neprune neprune merged commit 4afb9b8 into master May 7, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants