diff options
author | Dave Whiteland <dave@mysociety.org> | 2012-06-25 14:33:57 +0100 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2012-06-25 14:33:57 +0100 |
commit | f9fe02f91ac72ea2954ee68a5f32d96a237fcd67 (patch) | |
tree | f91d63ab3d6b9cd3555587090a541c870ecd3363 /perllib/FixMyStreet/App/Controller/Photo.pm | |
parent | 67da8efc720d2d0bd22bd9fe8655b7e983b35bb4 (diff) | |
parent | 45b3040884d7089e7d8c6f4acccd657b91c92a04 (diff) |
Merge branch 'master' into fmb-read-only
Conflicts:
.gitignore
bin/make_css
perllib/FixMyStreet/Cobrand/FixMyStreet.pm
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Photo.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Photo.pm | 6 |
1 files changed, 6 insertions, 0 deletions
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' ); |