diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-01-08 11:28:01 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-01-08 11:28:01 +0000 |
commit | c147fa9e46fc8b87b9e45fe9770d1a84c081736e (patch) | |
tree | 4b6ef524973f5c3d04058e1b9eeb69ce0cc7a584 /perllib | |
parent | 5c1f5df6e9942f307cade6215074c3d004da14c0 (diff) |
Fix cache busting in photo URL on multiple photos.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/Utils/Photo.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/perllib/Utils/Photo.pm b/perllib/Utils/Photo.pm index a1af90fe1..17514f195 100644 --- a/perllib/Utils/Photo.pm +++ b/perllib/Utils/Photo.pm @@ -4,8 +4,8 @@ use Image::Size; =head2 get_photo_params -Returns a hashref of details of any attached photo for use in templates. -Hashref contains height, width and url keys. +Returns a hashref of details of any attached photo (the first, if multiple +ones) for use in templates. Hashref contains height, width and url keys. =cut @@ -20,7 +20,12 @@ sub get_photo_params { my $post = '.jpeg'; my $photo = {}; - if (length($self->photo) == 40) { + if ($self->can('get_photoset')) { + my $data = $self->get_photoset()->get_raw_image_data(0); + my $fileid = $data->[0]; + $post .= '?' . $fileid; + $photo->{url_full} = "$pre.full$post"; + } elsif (length($self->photo) == 40) { $post .= '?' . $self->photo; $photo->{url_full} = "$pre.full$post"; # XXX Can't use size here because {url} (currently 250px height) may be |