Index: trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php |
— | — | @@ -275,7 +275,7 @@ |
276 | 276 | * Supports extra parameters for multipage files and thumbnail type (lossless vs. lossy) |
277 | 277 | */ |
278 | 278 | function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) { |
279 | | - global $wgImageMagickConvertCommand, $wgTiffMaxEmbedFileResolution, |
| 279 | + global $wgImageMagickConvertCommand, $wgMaxImageAreaForVips, |
280 | 280 | $wgTiffUseVips, $wgTiffVipsCommand, $wgMaxImageArea; |
281 | 281 | |
282 | 282 | $meta = $this->getMetaArray( $image ); |
— | — | @@ -314,13 +314,6 @@ |
315 | 315 | $height, $dstPath, $page ); |
316 | 316 | } |
317 | 317 | |
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 | | - |
325 | 318 | if ( !wfMkdirParents( dirname( $dstPath ) ) ) |
326 | 319 | return $this->doThumbError( $params, 'thumbnail_dest_directory' ); |
327 | 320 | |
— | — | @@ -329,7 +322,13 @@ |
330 | 323 | if ( !$pagesize ) { |
331 | 324 | return $this->doThumbError( $params, 'tiff_no_metadata' ); |
332 | 325 | } |
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 | + |
334 | 333 | // Shrink factors must be > 1. |
335 | 334 | if ( ( $pagesize['width'] > $width ) && ( $pagesize['height'] > $height ) ) { |
336 | 335 | $xfac = $pagesize['width'] / $width; |
Index: trunk/extensions/PagedTiffHandler/PagedTiffHandler.php |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | // Maximum number of embedded files in tiff image |
90 | 90 | $wgTiffMaxEmbedFiles = 10000; |
91 | 91 | // 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 |
93 | 93 | // Maximum size of metadata |
94 | 94 | $wgTiffMaxMetaSize = 64*1024; |
95 | 95 | // TTL of cache entries for errors |