diff options
Diffstat (limited to 'perllib/FixMyStreet/App.pm')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index b76f4d3ba..ee5b11876 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -86,6 +86,13 @@ __PACKAGE__->config( # Start the application __PACKAGE__->setup(); +# Due to some current issues with proxyings, need to manually +# tell the code we're secure if we are. +after 'prepare_headers' => sub { + my $self = shift; + $self->req->secure( 1 ) if $self->config->{BASE_URL} eq 'https://www.zueriwieneu.ch'; +}; + # set up DB handle for old code FixMyStreet->configure_mysociety_dbhandle; @@ -315,6 +322,7 @@ sub send_email { { _template_ => $email->body, # will get line wrapped _parameters_ => {}, + _line_indent => $c->cobrand->email_indent, $email->header_pairs } ) }; @@ -443,18 +451,29 @@ Hashref contains height, width and url keys. sub get_photo_params { my ($self, $key) = @_; - $key = ($key eq 'id') ? '' : "/$key"; return {} unless $self->photo; + $key = ($key eq 'id') ? '' : "/$key"; + + my $pre = "/photo$key/" . $self->id; + my $post = '.jpeg'; my $photo = {}; + if (length($self->photo) == 40) { - $photo->{url_full} = '/photo' . $key . '/' . $self->id . '.full.jpeg'; + $post .= '?' . $self->photo; + $photo->{url_full} = "$pre.full$post"; + # XXX Can't use size here because {url} (currently 250px height) may be + # being used, but at this point it doesn't yet exist to find the width + # $str = FixMyStreet->config('UPLOAD_DIR') . $self->photo . '.jpeg'; } else { - ( $photo->{width}, $photo->{height} ) = - Image::Size::imgsize( \$self->photo ); + my $str = \$self->photo; + ( $photo->{width}, $photo->{height} ) = Image::Size::imgsize( $str ); } - $photo->{url} = '/photo' . $key . '/' . $self->id . '.jpeg'; + + $photo->{url} = "$pre$post"; + $photo->{url_tn} = "$pre.tn$post"; + $photo->{url_fp} = "$pre.fp$post"; return $photo; } |