Last modified: 2014-05-27 10:51:29 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T67158, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 65158 - $wgImageLimits filter not correct
$wgImageLimits filter not correct
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.23.0
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-10 20:14 UTC by forwardin
Modified: 2014-05-27 10:51 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description forwardin 2014-05-10 20:14:52 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;
							}
						}
Comment 1 Andre Klapper 2014-05-11 12:53:08 UTC
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!
Comment 2 Gerrit Notification Bot 2014-05-11 16:13:36 UTC
Change 132831 had a related patch set uploaded by Scnd:
bug 65158

https://gerrit.wikimedia.org/r/132831
Comment 3 Gerrit Notification Bot 2014-05-27 10:51:29 UTC
Change 135545 had a related patch set uploaded by Krinkle:
$wgImageLimits filter not correct

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links