aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Roles/PhotoSet.pm
diff options
context:
space:
mode:
authorGraeme Porteous <graeme@rgbp.co.uk>2019-12-18 16:16:54 +0000
committerDave Arter <davea@mysociety.org>2020-01-27 16:00:41 +0000
commit2d6af993630d9e43594975e093507ee62ed53b97 (patch)
tree514de24dd76344d88dcd5bf6494dbda519e90ebe /perllib/FixMyStreet/Roles/PhotoSet.pm
parent856ae6bed192345249df8569518a4ecd074b3dc0 (diff)
Add per report OpenGraph images
Includes a bit of refactoring of PhotoSet::get_image_data to make it easier to call subsequent methods on the photo object. We then do this to get the width and height. Also adds width/height attributes to FixMyStreet::ImageMagick Attributes are updated every time the image is transformed and before the as_blob data, which also undefs the image, is returned so it always present for subsequent calls. Fixes #2394.
Diffstat (limited to 'perllib/FixMyStreet/Roles/PhotoSet.pm')
-rw-r--r--perllib/FixMyStreet/Roles/PhotoSet.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Roles/PhotoSet.pm b/perllib/FixMyStreet/Roles/PhotoSet.pm
index 27a63bad5..3d0027f8c 100644
--- a/perllib/FixMyStreet/Roles/PhotoSet.pm
+++ b/perllib/FixMyStreet/Roles/PhotoSet.pm
@@ -31,6 +31,11 @@ sub get_first_image_fp {
return $self->get_photoset->get_image_data( num => 0, size => 'fp' );
}
+sub get_first_image_og {
+ my ($self) = @_;
+ return $self->get_photoset->get_image_data( num => 0, size => 'og' );
+}
+
sub photos {
my $self = shift;
my $photoset = $self->get_photoset;
@@ -62,6 +67,7 @@ sub photos {
url_full => "/photo/$typ$id.$i.full.$format?$cachebust",
url_tn => "/photo/$typ$id.$i.tn.$format?$cachebust",
url_fp => "/photo/$typ$id.$i.fp.$format?$cachebust",
+ url_og => "/photo/$typ$id.$i.og.$format?$cachebust",
idx => $i++,
}
} $photoset->all_ids;