r70121 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70120‎ | r70121 | r70122 >
Date:23:45, 28 July 2010
Author:mglaser
Status:ok
Tags:
Comment:
changed wgTiffMaxEmbedFileResolution to wgMaxImageAreaForVips
Modified paths:
  • /trunk/extensions/PagedTiffHandler/PagedTiffHandler.php (modified) (history)
  • /trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php
@@ -275,7 +275,7 @@
276276 * Supports extra parameters for multipage files and thumbnail type (lossless vs. lossy)
277277 */
278278 function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
279 - global $wgImageMagickConvertCommand, $wgTiffMaxEmbedFileResolution,
 279+ global $wgImageMagickConvertCommand, $wgMaxImageAreaForVips,
280280 $wgTiffUseVips, $wgTiffVipsCommand, $wgMaxImageArea;
281281
282282 $meta = $this->getMetaArray( $image );
@@ -314,13 +314,6 @@
315315 $height, $dstPath, $page );
316316 }
317317
318 - if ( isset( $meta['page_data'][$page]['pixels'] )
319 - && $meta['page_data'][$page]['pixels'] > $wgTiffMaxEmbedFileResolution )
320 - return $this->doThumbError( $params, 'tiff_sourcefile_too_large' );
321 -
322 - if ( ( $width * $height ) > $wgTiffMaxEmbedFileResolution )
323 - return $this->doThumbError( $params, 'tiff_targetfile_too_large' );
324 -
325318 if ( !wfMkdirParents( dirname( $dstPath ) ) )
326319 return $this->doThumbError( $params, 'thumbnail_dest_directory' );
327320
@@ -329,7 +322,13 @@
330323 if ( !$pagesize ) {
331324 return $this->doThumbError( $params, 'tiff_no_metadata' );
332325 }
333 -
 326+ if ( isset( $meta['page_data'][$page]['pixels'] )
 327+ && $meta['page_data'][$page]['pixels'] > $wgMaxImageAreaForVips )
 328+ return $this->doThumbError( $params, 'tiff_sourcefile_too_large' );
 329+
 330+ if ( ( $width * $height ) > $wgMaxImageAreaForVips )
 331+ return $this->doThumbError( $params, 'tiff_targetfile_too_large' );
 332+
334333 // Shrink factors must be > 1.
335334 if ( ( $pagesize['width'] > $width ) && ( $pagesize['height'] > $height ) ) {
336335 $xfac = $pagesize['width'] / $width;
Index: trunk/extensions/PagedTiffHandler/PagedTiffHandler.php
@@ -88,7 +88,7 @@
8989 // Maximum number of embedded files in tiff image
9090 $wgTiffMaxEmbedFiles = 10000;
9191 // Maximum resolution of embedded images (product of width x height pixels)
92 -$wgTiffMaxEmbedFileResolution = 1600*1600; // max. Resolution 1600 x 1600 pixels
 92+$wgMaxImageAreaForVips = 1600*1600; // max. Resolution 1600 x 1600 pixels
9393 // Maximum size of metadata
9494 $wgTiffMaxMetaSize = 64*1024;
9595 // TTL of cache entries for errors

Status & tagging log