Skip to content

Commit

Permalink
Merge pull request #1145 from afuna/s2-imgroot-cache-bug-1134
Browse files Browse the repository at this point in the history
[#1134] Use protocol-relative URL for image objects in S2
  • Loading branch information
zorkian committed Jan 25, 2015
2 parents 7fc8a3f + 831f293 commit c5983b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cgi-bin/LJ/S2.pm
Expand Up @@ -2442,6 +2442,9 @@ sub Image_std
my $name = shift;
my $ctx = $LJ::S2::CURR_CTX or die "No S2 context available ";

my $imgprefix = $LJ::IMGPREFIX;
$imgprefix =~ s/^https?://;

unless ($LJ::S2::RES_MADE++) {
$LJ::S2::RES_CACHE = {};
my $textmap = {
Expand All @@ -2456,7 +2459,7 @@ sub Image_std
foreach ( keys %$textmap ) {
my $i = $LJ::Img::img{$_};
$LJ::S2::RES_CACHE->{$_} =
Image( "$LJ::IMGPREFIX$i->{src}",
Image( "$imgprefix$i->{src}",
$i->{width}, $i->{height},
$ctx->[S2::PROPS]->{ $textmap->{$_} } );
}
Expand All @@ -2469,7 +2472,7 @@ sub Image_std
foreach ( @ic ) {
my $i = $LJ::Img::img{$_};
$LJ::S2::RES_CACHE->{$_} =
Image( "$LJ::IMGPREFIX$i->{src}",
Image( "$imgprefix$i->{src}",
$i->{width}, $i->{height},
LJ::Lang::ml( $i->{alt} ) );
}
Expand Down

0 comments on commit c5983b9

Please sign in to comment.