aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm15
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm20
2 files changed, 20 insertions, 15 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index ff4bb080c..ff471d7cd 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -200,7 +200,6 @@ sub format_problem_for_display : Private {
$c->stash->{email} = $c->req->param('rznvy');
$c->forward('generate_map_tags');
- $c->forward('generate_problem_photo');
$c->forward('generate_problem_meta');
# problem_updates => Page::display_problem_updates($input{id}, $q),
@@ -243,20 +242,6 @@ sub generate_map_tags : Private {
return 1;
}
-sub generate_problem_photo : Private {
- my ( $self, $c ) = @_;
-
- my $problem = $c->stash->{problem};
-
- if ( $c->cobrand->allow_photo_display and $problem->photo ) {
- my $photo = {};
- ( $photo->{width}, $photo->{height} ) =
- Image::Size::imgsize( \$problem->photo );
- $photo->{url} = '/photo/?id=' . $problem->id;
- $c->stash->{photo} = $photo;
- }
-}
-
sub generate_problem_meta : Private {
my ( $self, $c ) = @_;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 57bbf5fb8..d91e8c324 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -225,4 +225,24 @@ sub url {
return "/report/" . $self->id;
}
+=head2 get_photo_params
+
+Returns a hashref of details of any attached photo for use in templates.
+Hashref contains height, width and url keys.
+
+=cut
+
+sub get_photo_params {
+ my $self = shift;
+
+ return {} unless $self->photo;
+
+ my $photo = {};
+ ( $photo->{width}, $photo->{height} ) =
+ Image::Size::imgsize( \$self->photo );
+ $photo->{url} = '/photo/?id=' . $self->id;
+
+ return $photo;
+}
+
1;