Add HiDPI PNG variants for 'Powered by MediaWiki' footer icon
authorBrion Vibber <brion@pobox.com>
Mon, 13 Oct 2014 14:15:12 +0000 (07:15 -0700)
committerJforrester <jforrester@wikimedia.org>
Fri, 23 Jan 2015 21:27:24 +0000 (21:27 +0000)
Added 1.5x and 2x-density variants of the 'Powered by MediaWiki' footer
icon, built from this SVG version on Commons:

  https://commons.wikimedia.org/wiki/File:Powered_by_MediaWiki.svg

Note the SVG version is too large to use directly right now as it
contains a huge amount of detail; the PNGs are only a few KiB.

Renderings from Commons taken and run through pngcrush.

Note that adding 'srcset' attributes to footer icons appears to work
just fine here, so can be done for others.

Bug: T65872
Change-Id: I785d21add456eeddb6ed1ee36a1906d178323e63

includes/DefaultSettings.php
includes/Setup.php
includes/skins/Skin.php
resources/assets/poweredby_mediawiki_132x47.png [new file with mode: 0644]
resources/assets/poweredby_mediawiki_176x62.png [new file with mode: 0644]

index 8060983..f9dc1ed 100644 (file)
@@ -3154,6 +3154,7 @@ $wgExperimentalHtmlIds = false;
  * for the icon, the following keys are used:
  * - src: An absolute url to the image to use for the icon, this is recommended
  *        but not required, however some skins will ignore icons without an image
+ * - srcset: optional additional-resolution images; see HTML5 specs
  * - url: The url to use in the a element around the text or icon, if not set an a element will
  *        not be outputted
  * - alt: This is the text form of the icon, it will be displayed without an image in
@@ -3170,7 +3171,7 @@ $wgFooterIcons = array(
        ),
        "poweredby" => array(
                "mediawiki" => array(
-                       "src" => null, // Defaults to "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png"
+                       "src" => null, // Defaults to "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" plus srcset for 1.5x, 2x
                        "url" => "//www.mediawiki.org/",
                        "alt" => "Powered by MediaWiki",
                )
index c75429e..4e63d91 100644 (file)
@@ -140,6 +140,9 @@ if ( isset( $wgFooterIcons['poweredby'] )
 ) {
        $wgFooterIcons['poweredby']['mediawiki']['src'] =
                "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
+       $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
+               "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
+               "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
 }
 
 /**
index 999dda8..752387b 100644 (file)
@@ -837,9 +837,12 @@ abstract class Skin extends ContextSource {
        function getPoweredBy() {
                global $wgResourceBasePath;
 
-               $url = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" );
-               $text = '<a href="//www.mediawiki.org/"><img src="' . $url
-                       . '" height="31" width="88" alt="Powered by MediaWiki" /></a>';
+               $url1 = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png" );
+               $url1_5 = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png" );
+               $url2 = htmlspecialchars( "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png" );
+               $text = '<a href="//www.mediawiki.org/"><img src="' . $url1
+                       . '" srcset="' . $url1_5 . ' 1.5x, ' . $url2 . ' 2x" '
+                       . 'height="31" width="88" alt="Powered by MediaWiki" /></a>';
                Hooks::run( 'SkinGetPoweredBy', array( &$text, $this ) );
                return $text;
        }
diff --git a/resources/assets/poweredby_mediawiki_132x47.png b/resources/assets/poweredby_mediawiki_132x47.png
new file mode 100644 (file)
index 0000000..a784ecf
Binary files /dev/null and b/resources/assets/poweredby_mediawiki_132x47.png differ
diff --git a/resources/assets/poweredby_mediawiki_176x62.png b/resources/assets/poweredby_mediawiki_176x62.png
new file mode 100644 (file)
index 0000000..7970801
Binary files /dev/null and b/resources/assets/poweredby_mediawiki_176x62.png differ