http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70121

Revision: 70121
Author:   mglaser
Date:     2010-07-28 23:45:25 +0000 (Wed, 28 Jul 2010)

Log Message:
-----------
changed wgTiffMaxEmbedFileResolution to wgMaxImageAreaForVips

Modified Paths:
--------------
    trunk/extensions/PagedTiffHandler/PagedTiffHandler.php
    trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php

Modified: trunk/extensions/PagedTiffHandler/PagedTiffHandler.php
===================================================================
--- trunk/extensions/PagedTiffHandler/PagedTiffHandler.php      2010-07-28 
22:44:33 UTC (rev 70120)
+++ trunk/extensions/PagedTiffHandler/PagedTiffHandler.php      2010-07-28 
23:45:25 UTC (rev 70121)
@@ -88,7 +88,7 @@
 // Maximum number of embedded files in tiff image
 $wgTiffMaxEmbedFiles = 10000;
 // Maximum resolution of embedded images (product of width x height pixels)
-$wgTiffMaxEmbedFileResolution = 1600*1600; // max. Resolution 1600 x 1600 
pixels
+$wgMaxImageAreaForVips = 1600*1600; // max. Resolution 1600 x 1600 pixels
 // Maximum size of metadata
 $wgTiffMaxMetaSize = 64*1024; 
 // TTL of cache entries for errors

Modified: trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php
===================================================================
--- trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php 2010-07-28 
22:44:33 UTC (rev 70120)
+++ trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php 2010-07-28 
23:45:25 UTC (rev 70121)
@@ -275,7 +275,7 @@
         * Supports extra parameters for multipage files and thumbnail type 
(lossless vs. lossy)
         */
        function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
-               global $wgImageMagickConvertCommand, 
$wgTiffMaxEmbedFileResolution, 
+               global $wgImageMagickConvertCommand, $wgMaxImageAreaForVips, 
                        $wgTiffUseVips, $wgTiffVipsCommand, $wgMaxImageArea;
 
                $meta = $this->getMetaArray( $image );
@@ -314,13 +314,6 @@
                                $height, $dstPath, $page );
                }
 
-               if ( isset( $meta['page_data'][$page]['pixels'] ) 
-                               && $meta['page_data'][$page]['pixels'] > 
$wgTiffMaxEmbedFileResolution )
-                       return $this->doThumbError( $params, 
'tiff_sourcefile_too_large' );
-
-               if ( ( $width * $height ) > $wgTiffMaxEmbedFileResolution )
-                       return $this->doThumbError( $params, 
'tiff_targetfile_too_large' );
-
                if ( !wfMkdirParents( dirname( $dstPath ) ) )
                        return $this->doThumbError( $params, 
'thumbnail_dest_directory' );
 
@@ -329,7 +322,13 @@
                        if ( !$pagesize ) {
                                return $this->doThumbError( $params, 
'tiff_no_metadata' );
                        }
-                       
+                       if ( isset( $meta['page_data'][$page]['pixels'] ) 
+                                       && $meta['page_data'][$page]['pixels'] 
> $wgMaxImageAreaForVips )
+                               return $this->doThumbError( $params, 
'tiff_sourcefile_too_large' );
+
+                       if ( ( $width * $height ) > $wgMaxImageAreaForVips )
+                               return $this->doThumbError( $params, 
'tiff_targetfile_too_large' );                     
+                               
                        // Shrink factors must be > 1.
                        if ( ( $pagesize['width'] > $width ) && ( 
$pagesize['height'] > $height ) ) {
                                $xfac = $pagesize['width'] / $width;



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to