Tholam has uploaded a new change for review.

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


Change subject: Updated ImagePage to use HiDPI (GCI Student)
......................................................................

Updated ImagePage to use HiDPI (GCI Student)

Changed processResponsiveImages method in Linker class from
protected to public so that it may be used in the ImagePage class.
called the method in the openShowImage method to generate the srcset.

Bug: 56969
Change-Id: I0888d7a5d3289da3ef2d7a7eb35183bed170f91e
---
M includes/ImagePage.php
M includes/Linker.php
2 files changed, 3 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/14/96414/1

diff --git a/includes/ImagePage.php b/includes/ImagePage.php
index 3365d1b..4ea1712 100644
--- a/includes/ImagePage.php
+++ b/includes/ImagePage.php
@@ -415,7 +415,7 @@
                                $params['width'] = $width;
                                $params['height'] = $height;
                                $thumbnail = $this->displayImg->transform( 
$params );
-                               
self::processResponsiveImages($this->displayImg, $thumbnail, $params);
+                               Linker::processResponsiveImages( 
$this->displayImg, $thumbnail, $params );
 
                                $anchorclose = Html::rawElement( 'div', array( 
'class' => 'mw-filepage-resolutioninfo' ), $msgsmall );
 
@@ -587,36 +587,6 @@
                        }
                }
                $out->setFileVersion( $this->displayImg );
-       }
-
-       /**
-        * Process responsive images: add 1.5x and 2x subimages to the 
thumbnail, where
-        * applicable.
-        *
-        * @param File $file
-        * @param MediaOutput $thumb
-        * @param array $hp image parameters
-        */
-       protected static function processResponsiveImages( $file, $thumb, $hp ) 
{
-               global $wgResponsiveImages;
-               if ( $wgResponsiveImages ) {
-                       $hp15 = $hp;
-                       $hp15['width'] = round( $hp['width'] * 1.5 );
-                       $hp20 = $hp;
-                       $hp20['width'] = $hp['width'] * 2;
-                       if ( isset( $hp['height'] ) ) {
-                               $hp15['height'] = round( $hp['height'] * 1.5 );
-                               $hp20['height'] = $hp['height'] * 2;
-                       }
-                       $thumb15 = $file->transform( $hp15 );
-                       $thumb20 = $file->transform( $hp20 );
-                       if ( $thumb15->url !== $thumb->url ) {
-                               $thumb->responsiveUrls['1.5'] = $thumb15->url;
-                       }
-                       if ( $thumb20->url !== $thumb->url ) {
-                               $thumb->responsiveUrls['2'] = $thumb20->url;
-                       }
-               }
        }
 
        /**
diff --git a/includes/Linker.php b/includes/Linker.php
index 4dcdfd5..01ced70 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -1,4 +1,4 @@
-<?php
+ <?php
 /**
  * Methods to make links and related items.
  *
@@ -902,7 +902,7 @@
         * @param MediaOutput $thumb
         * @param array $hp image parameters
         */
-       protected static function processResponsiveImages( $file, $thumb, $hp ) 
{
+       public static function processResponsiveImages( $file, $thumb, $hp ) {
                global $wgResponsiveImages;
                if ( $wgResponsiveImages ) {
                        $hp15 = $hp;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0888d7a5d3289da3ef2d7a7eb35183bed170f91e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tholam <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to