aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-04-08 21:11:48 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-04-08 22:05:21 +0100
commitb7099e8e513fe64ec183b1403515f46a7cc25f19 (patch)
tree8a0399a49f90acfe5b74cf19d86585cc050455d7 /perllib/FixMyStreet/DB
parent0802b7f04091c1022dce0d77cc806a46ecc4ebba (diff)
Add PNG image support.
Store image type along with hash in photo column, and use that when outputting images / generating URLs. Make sure all public photo URL generation goes through appropriate functions, and change temp URLs so the filename can be output directly from the list.
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm8
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm8
2 files changed, 8 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index e5929ca57..85cdb29f0 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -173,12 +173,12 @@ sub photos {
my $i = 0;
my $id = $self->id;
my @photos = map {
- my $format = 'jpeg';
my $cachebust = substr($_, 0, 8);
+ my ($hash, $format) = split /\./, $_;
{
- id => $_,
- url_temp => "/photo/$_.temp.$format",
- url_temp_full => "/photo/$_.fulltemp.$format",
+ id => $hash,
+ url_temp => "/photo/temp.$hash.$format",
+ url_temp_full => "/photo/fulltemp.$hash.$format",
url => "/photo/c/$id.$i.$format?$cachebust",
url_full => "/photo/c/$id.$i.full.$format?$cachebust",
idx => $i++,
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 780a30e69..764f381a2 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -875,12 +875,12 @@ sub photos {
my $i = 0;
my $id = $self->id;
my @photos = map {
- my $format = 'jpeg';
my $cachebust = substr($_, 0, 8);
+ my ($hash, $format) = split /\./, $_;
{
- id => $_,
- url_temp => "/photo/$_.temp.$format",
- url_temp_full => "/photo/$_.fulltemp.$format",
+ id => $hash,
+ url_temp => "/photo/temp.$hash.$format",
+ url_temp_full => "/photo/fulltemp.$hash.$format",
url => "/photo/$id.$i.$format?$cachebust",
url_full => "/photo/$id.$i.full.$format?$cachebust",
url_tn => "/photo/$id.$i.tn.$format?$cachebust",