Backend for entry userpics (also has full, small, smaller as options)
Patch by fu.
diffs (75 lines):
diff -r f3d2493c9451 -r d848707362a3 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm Mon Apr 18 13:29:19 2011 +0800
+++ b/cgi-bin/LJ/S2.pm Mon Apr 18 13:32:13 2011 +0800
@@ -1885,6 +1885,19 @@ sub Entry
$e->{$_} = $arg->{$_};
}
+ my $pic = $e->{userpic};
+ if ( $pic->{url} ) {
+ my $userpic_style = $arg->{userpic_style} || "";
+
+ if ( $userpic_style eq 'small' ) {
+ $pic->{width} = $pic->{width} * 3 / 4;
+ $pic->{height} = $pic->{height} * 3 / 4;
+ } elsif ( $userpic_style eq "smaller" ) {
+ $pic->{width} = $pic->{width} / 2;
+ $pic->{height} = $pic->{height} / 2;
+ }
+ }
+
my $remote = LJ::get_remote();
my $poster = $e->{poster}->{_u};
@@ -2034,6 +2047,8 @@ sub Entry_from_entryobj
} else {
$userpic = Image_userpic( $journal, $journal->userpic->picid ) if
$journal->userpic;
}
+
+ my $userpic_style = S2::get_property_value( $opts->{ctx},
'entry_userpic_style' );
# override used moodtheme if necessary
my $moodthemeid = $u->prop( 'opt_forcemoodtheme' ) eq 'Y' ?
@@ -2065,6 +2080,7 @@ sub Entry_from_entryobj
new_day => 0, #if true, set later
end_day => 0, #if true, set later
userpic => $userpic,
+ userpic_style => $userpic_style,
tags => $taglist,
permalink_url => $entry_obj->url,
moodthemeid => $moodthemeid,
diff -r f3d2493c9451 -r d848707362a3 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm Mon Apr 18 13:29:19 2011 +0800
+++ b/cgi-bin/LJ/S2/EntryPage.pm Mon Apr 18 13:32:13 2011 +0800
@@ -175,19 +175,15 @@ sub EntryPage
}
my $comment_userpic;
- my $comment_userpic_style =
$opts->{ctx}->[S2::PROPS]->{comment_userpic_style};
- if ( defined $com->{picid} && ( my $pic = $userpic{$com->{picid}}
) && ( $comment_userpic_style ne 'off' ) ) {
+ my $comment_userpic_style = S2::get_property_value( $opts->{ctx},
'comment_userpic_style' ) || "";
+ if ( defined $com->{picid} && ( my $pic = $userpic{$com->{picid}}
) ) {
my $width = $pic->{width};
my $height = $pic->{height};
- if ( $comment_userpic_style eq 'small' )
- {
+ if ( $comment_userpic_style eq 'small' ) {
$width = $width * 3 / 4;
$height = $height * 3 / 4;
- }
-
- if ( $comment_userpic_style eq 'smaller' )
- {
+ } elsif ( $comment_userpic_style eq 'smaller' ) {
$width = $width / 2;
$height = $height / 2;
}
@@ -551,6 +547,7 @@ sub EntryPage_entry
new_day => 0,
end_day => 0,
userpic => $userpic,
+ userpic_style => S2::get_property_value( $opts->{ctx},
'entry_userpic_style' ),
permalink_url => $entry->url,
timeformat24 => $remote && $remote->use_24hour_time,
} );
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog