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
Conversation
Codecov ReportAttention: Patch coverage is
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. |
83334e1
to
93c1c49
Compare
@dracos I still need to write tests for some coverage but sharing in case you have an early feedback. |
8936ab4
to
ee065c8
Compare
@dracos Added some tests now, ready for review. |
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.
A few small suggestions is all :)
my @images = $self->all_ids; | ||
foreach my $i (0.. $#images) { | ||
my $blob = $self->get_raw_image($i)->{data}; | ||
while (length $blob > $size_bytes) { |
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.
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 %).
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.
Thanks :)
[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.