Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[livejournal] r15113: Support for preview images for custom th...

Committer: gariev
Support for preview images for custom themes

U   trunk/cgi-bin/LJ/S2Theme.pm
Modified: trunk/cgi-bin/LJ/S2Theme.pm
===================================================================
--- trunk/cgi-bin/LJ/S2Theme.pm	2009-04-08 07:46:08 UTC (rev 15112)
+++ trunk/cgi-bin/LJ/S2Theme.pm	2009-04-08 07:52:39 UTC (rev 15113)
@@ -501,13 +501,24 @@
 sub preview_imgurl {
     my $self = shift;
 
-    my $imgurl = "$LJ::IMGPREFIX/customize/previews/";
-    $imgurl .= $self->uniq ? $self->uniq : "custom-layer";
-    $imgurl .= ".png";
-
-    return $imgurl;
+    ## system styles
+    if (my $uniq = $self->uniq) {
+        return "$LJ::IMGPREFIX/customize/previews/$uniq.png";
+    }
+    
+    ## custom styles with defined preview image
+    my %info;
+    LJ::S2::load_layer_info(\%info, [ $self->{s2lid} ]);
+    if (my $url = $info{ $self->{s2lid} }{preview_imgurl}) {
+        $url = "$LJ::IMGPREFIX/$url" unless $url =~ /^http/i;
+        return LJ::ehtml($url);
+    }
+    
+    ## default "custom layer" icon
+    return "$LJ::IMGPREFIX/customize/previews/custom-layer.png";
 }
 
+    
 sub available_to {
     my $self = shift;
     my $u = shift;

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments