https://bugzilla.wikimedia.org/show_bug.cgi?id=65158

            Bug ID: 65158
           Summary: $wgImageLimits filter not correct
           Product: MediaWiki
           Version: 1.23-git
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: Unprioritized
         Component: File management
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected]
       Web browser: ---
   Mobile Platform: ---

$wgImageLimits = array(
    array(320,  3000),
    array(640,  3000),
    array(800,  3000),
    array(1024, 3000),
    array(1280, 3000),
    array(1600, 3000),
    array(1900, 3000)
);
I want limit only images widths, so I setted all heights to 3000. Now if image
height less than 3000 then "Other resolutions" on image page (like
https://www.mediawiki.org/wiki/File:Astronotus_ocellatus.jpg) is not displaying
(only original size), because of this part in ImagePage.php
https://github.com/wikimedia/mediawiki-core/blob/a3983418d5748fbccdda15e0e48af90c50ef1f67/includes/ImagePage.php#L386:

                        if ( $size[0] <= $width_orig && $size[1] <=
$height_orig
                             && $size[0] != $width && $size[1] != $height
                        ) {
                             $sizeLink = $this->makeSizeLink( $params,
$size[0], $size[1] );
                            if ( $sizeLink ) {
                                  $otherSizes[] = $sizeLink;
                            }
                         }

If one of this rules not true, size not included:
$size[0] <= $width_orig // if width from $wgImageLimits less than origin
$size[1] <= $height_orig // if height from $wgImageLimits less than origin
$size[0] != $width // almost always true
$size[1] != $height // almost always true

But size should be not included only if width OR height less than origin. So
hotfix will be:

                        if ( ( $size[0] <= $width_orig || $size[1] <=
$height_orig )
                            && $size[0] != $width && $size[1] != $height
                        ) {
                            $sizeLink = $this->makeSizeLink( $params, $size[0],
$size[1] );
                             if ( $sizeLink ) {
                                $otherSizes[] = $sizeLink;
                            }
                        }

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to