aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--perllib/FixMyStreet/App/Controller/Photo.pm6
2 files changed, 7 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 974d01d6b..30daa380c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@ tags
/web/css/main.css
/web/cobrands/fixmystreet/*.css
/web/cobrands/bromley/*.css
+/web/photo
/local
/web/cobrands/fixmystreet/compass_app_log.txt
diff --git a/perllib/FixMyStreet/App/Controller/Photo.pm b/perllib/FixMyStreet/App/Controller/Photo.pm
index a6717fc33..fc4c3fde7 100644
--- a/perllib/FixMyStreet/App/Controller/Photo.pm
+++ b/perllib/FixMyStreet/App/Controller/Photo.pm
@@ -6,6 +6,8 @@ BEGIN {extends 'Catalyst::Controller'; }
use DateTime::Format::HTTP;
use Digest::SHA1 qw(sha1_hex);
+use File::Path;
+use File::Slurp;
use Path::Class;
=head1 NAME
@@ -95,6 +97,10 @@ sub index :LocalRegex('^(c/)?(\d+)(?:\.(full|tn|fp))?\.jpeg$') {
sub output : Private {
my ( $self, $c, $photo ) = @_;
+ # Save to file
+ File::Path::make_path( FixMyStreet->path_to( 'web', 'photo', 'c' )->stringify );
+ File::Slurp::write_file( FixMyStreet->path_to( 'web', $c->req->path )->stringify, \$photo );
+
my $dt = DateTime->now()->add( years => 1 );
$c->res->content_type( 'image/jpeg' );