Last modified: 2014-05-27 10:51:29 UTC
$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; } }
Thanks for taking the time to report this and investigating the code! Would you be willing to provide a patch? You are welcome to use Developer access https://www.mediawiki.org/wiki/Developer_access to submit this as a Git branch directly into Gerrit: https://www.mediawiki.org/wiki/Git/Tutorial Putting your branch in Git makes it easier to review it quickly. If you don't want to set up Git/Gerrit, you can also use https://tools.wmflabs.org/gerrit-patch-uploader/ - Thanks again!
Change 132831 had a related patch set uploaded by Scnd: bug 65158 https://gerrit.wikimedia.org/r/132831
Change 135545 had a related patch set uploaded by Krinkle: $wgImageLimits filter not correct https://gerrit.wikimedia.org/r/135545