aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2016-02-23 16:37:14 +0000
committerMatthew Somerville <matthew@mysociety.org>2016-02-23 18:11:18 +0000
commit0d0b35dadf3ebf4781e00ae8d83b4061a99cfcc6 (patch)
tree722afef3118275cc9d952d45e89fbd8e75ba746a /perllib/FixMyStreet/Cobrand
parent28144f5153a0a7f7bad9466c883bd5c147568028 (diff)
Only load images from disk when needed.
Fixes #1337.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand')
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm12
1 files changed, 5 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index ea4eda8c4..c7e3c4d45 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -1014,23 +1014,21 @@ sub munge_sendreport_params {
if ($row->state =~ /^(closed|investigating)$/ && $row->get_extra_metadata('publish_photo')) {
# we attach images to reports sent to external bodies
my $photoset = $row->get_photoset();
- my @images = $photoset->all_images
+ my $num = $photoset->num_images
or return;
- my $index = 0;
my $id = $row->id;
my @attachments = map {
- my $i = $index++;
{
- body => $_->[1],
+ body => $photoset->get_raw_image_data($_),
attributes => {
- filename => "$id.$i.jpeg",
+ filename => "$id.$_.jpeg",
content_type => 'image/jpeg',
encoding => 'base64',
# quoted-printable ends up with newlines corrupting binary data
- name => "$id.$i.jpeg",
+ name => "$id.$_.jpeg",
},
}
- } @images;
+ } (0..$num-1);
$params->{attachments} = \@attachments;
}
}