aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-07 18:08:58 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-07 18:09:05 +0000
commit3d631a9ee48fbff1741525f7ad9e9a530854d03b (patch)
tree0a1f2ad022fe90145fe78938fb7ca844dadb370f /perllib/FixMyStreet/App.pm
parent54aeaf92acf5091c3b90d91848005893371e9590 (diff)
Add hash as query parameter on photos so that rotating instantly works, no cache issues (fixes a3).
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r--perllib/FixMyStreet/App.pm21
1 files changed, 15 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index b76f4d3ba..b57e78a9e 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -443,18 +443,27 @@ Hashref contains height, width and url keys.
sub get_photo_params {
my ($self, $key) = @_;
- $key = ($key eq 'id') ? '' : "/$key";
return {} unless $self->photo;
+ $key = ($key eq 'id') ? '' : "/$key";
+
+ my $pre = "/photo$key/" . $self->id;
+ my $post = '.jpeg';
+ my $str = \$self->photo;
my $photo = {};
+
if (length($self->photo) == 40) {
- $photo->{url_full} = '/photo' . $key . '/' . $self->id . '.full.jpeg';
- } else {
- ( $photo->{width}, $photo->{height} ) =
- Image::Size::imgsize( \$self->photo );
+ $post .= '?' . $self->photo;
+ $photo->{url_full} = "$pre.full$post";
+ $str = FixMyStreet->config('UPLOAD_DIR') . $self->photo . '.jpeg';
}
- $photo->{url} = '/photo' . $key . '/' . $self->id . '.jpeg';
+
+ ( $photo->{width}, $photo->{height} ) = Image::Size::imgsize( $str );
+
+ $photo->{url} = "$pre$post";
+ $photo->{url_tn} = "$pre.tn$post";
+ $photo->{url_fp} = "$pre.fp$post";
return $photo;
}