diff options
Diffstat (limited to 'perllib/FixMyStreet/PhotoStorage.pm')
-rw-r--r-- | perllib/FixMyStreet/PhotoStorage.pm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/PhotoStorage.pm b/perllib/FixMyStreet/PhotoStorage.pm index 99f0bdab6..a441fb718 100644 --- a/perllib/FixMyStreet/PhotoStorage.pm +++ b/perllib/FixMyStreet/PhotoStorage.pm @@ -2,7 +2,18 @@ package FixMyStreet::PhotoStorage; use Moose; use Digest::SHA qw(sha1_hex); - +use Module::Load; +use FixMyStreet; + +our $instance; # our, so tests can set to undef when testing different backends +sub backend { + return $instance if $instance; + my $class = 'FixMyStreet::PhotoStorage::'; + $class .= FixMyStreet->config('PHOTO_STORAGE_BACKEND') || 'FileSystem'; + load $class; + $instance = $class->new(); + return $instance; +} sub detect_type { my ($self, $photo) = @_; |