Brian Wolff has uploaded a new change for review.

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

Change subject: Do not suggest alternate svg sizes bigger than $wgMaxSVGSize on 
img pg
......................................................................

Do not suggest alternate svg sizes bigger than $wgMaxSVGSize on img pg

Suggesting a size bigger than the max svg size, will simply result
in a smaller rendering than the user has been lead to believe they
would recieve.

Additionally fix wrong argument order to $this->getThumbSizes
which was causing the nominal size for an SVG to not be suggested
as an alternate size on the image page.

See some of the comments T106263 (However, that bug is not about
this issue).

Change-Id: Ia63ddd6e89725f8e7979687310c3b6819da0cbbc
---
M includes/page/ImagePage.php
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/88/225688/1

diff --git a/includes/page/ImagePage.php b/includes/page/ImagePage.php
index 7ea4ed7..c279837 100644
--- a/includes/page/ImagePage.php
+++ b/includes/page/ImagePage.php
@@ -296,7 +296,7 @@
        }
 
        protected function openShowImage() {
-               global $wgEnableUploads, $wgSend404Code;
+               global $wgEnableUploads, $wgSend404Code, $wgSVGMaxSize;
 
                $this->loadFile();
                $out = $this->getContext()->getOutput();
@@ -351,7 +351,7 @@
                                        );
                                        $linktext = $this->getContext()->msg( 
'show-big-image' )->escaped();
 
-                                       $thumbSizes = $this->getThumbSizes( 
$width, $height, $width_orig, $height_orig );
+                                       $thumbSizes = $this->getThumbSizes( 
$width_orig, $height_orig );
                                        # Generate thumbnails or thumbnail 
links as needed...
                                        $otherSizes = array();
                                        foreach ( $thumbSizes as $size ) {
@@ -361,10 +361,12 @@
                                                // the current thumbnail's size 
($width/$height)
                                                // since that is added to the 
message separately, so
                                                // it can be denoted as the 
current size being shown.
-                                               // Vectorized images are 
"infinitely" big, so all thumb
-                                               // sizes are shown.
+                                               // Vectorized images are 
limited by $wgSVGMaxSize big,
+                                               // so all thumbs less than that 
are shown.
                                                if ( ( ( $size[0] <= 
$width_orig && $size[1] <= $height_orig )
-                                                               || 
$this->displayImg->isVectorized() )
+                                                               || ( 
$this->displayImg->isVectorized()
+                                                                       && max( 
$size[0], $size[1] ) < $wgSVGMaxSize )
+                                                       )
                                                        && $size[0] != $width 
&& $size[1] != $height
                                                ) {
                                                        $sizeLink = 
$this->makeSizeLink( $params, $size[0], $size[1] );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia63ddd6e89725f8e7979687310c3b6819da0cbbc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <bawolff...@gmail.com>

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

Reply via email to