r51633 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51632‎ | r51633 | r51634 >
Date:10:10, 9 June 2009
Author:thomasv
Status:ok
Tags:
Comment:
max size for zoomable image
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage.php
@@ -20,6 +20,9 @@
2121 # Bump the version number every time you change proofread.js
2222 $wgProofreadPageVersion = 20;
2323
 24+# Max width of zoomable image
 25+$wgProofreadPageMaxWidth = 2048;
 26+
2427 $wgExtensionCredits['other'][] = array(
2528 'path' => __FILE__,
2629 'name' => 'ProofreadPage',
@@ -291,7 +294,7 @@
292295
293296
294297 function pr_preparePage( $out, $m, $isEdit ) {
295 - global $wgJsMimeType, $wgScriptPath, $wgRequest, $wgProofreadPageVersion;
 298+ global $wgJsMimeType, $wgScriptPath, $wgRequest, $wgProofreadPageVersion, $wgProofreadPageMaxWidth;
296299
297300 $imageTitle = Title::makeTitleSafe( NS_IMAGE, $m[1] );
298301 if ( !$imageTitle ) {
@@ -302,6 +305,10 @@
303306 if ( $image && $image->exists() ) {
304307 $width = $image->getWidth();
305308 $height = $image->getHeight();
 309+ if( $width > $wgProofreadPageMaxWidth ) {
 310+ $width = $wgProofreadPageMaxWidth;
 311+ $height = $image->getHeight() * $wgProofreadPageMaxWidth / $image->getWidth();
 312+ }
306313 if ( $m[2] ) {
307314 $viewName = $image->thumbName( array( 'width' => $width, 'page' => $m[3] ) );
308315 $viewURL = $image->getThumbUrl( $viewName );

Status & tagging log