Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/166416

Change subject: Add HiDPI PNG variants for 'Powered by MediaWiki' footer icon
......................................................................

Add HiDPI PNG variants for 'Powered by MediaWiki' footer icon

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: 63872
Change-Id: I785d21add456eeddb6ed1ee36a1906d178323e63
---
M includes/DefaultSettings.php
M includes/Setup.php
M includes/skins/Skin.php
A resources/assets/poweredby_mediawiki_132x47.png
A resources/assets/poweredby_mediawiki_176x62.png
5 files changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/16/166416/1

diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index f2453e8..2dae8fc 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -3117,6 +3117,7 @@
  * 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
@@ -3133,7 +3134,7 @@
        ),
        "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",
                )
diff --git a/includes/Setup.php b/includes/Setup.php
index 743936e..89c3d30 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -137,6 +137,9 @@
 ) {
        $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";
 }
 
 /**
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index c8c4ba4..c1ebe15 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -837,9 +837,12 @@
        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>';
                wfRunHooks( '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
index 0000000..a784ecf
--- /dev/null
+++ b/resources/assets/poweredby_mediawiki_132x47.png
Binary files differ
diff --git a/resources/assets/poweredby_mediawiki_176x62.png 
b/resources/assets/poweredby_mediawiki_176x62.png
new file mode 100644
index 0000000..7970801
--- /dev/null
+++ b/resources/assets/poweredby_mediawiki_176x62.png
Binary files differ

-- 
To view, visit https://gerrit.wikimedia.org/r/166416
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I785d21add456eeddb6ed1ee36a1906d178323e63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to