Merge "Update list item newline handling to follow Parsoid's model"
[lhc/web/wiklou.git] / includes / media / Tiff.php
index dda8265..bea6cab 100644 (file)
@@ -27,6 +27,8 @@
  * @ingroup Media
  */
 class TiffHandler extends ExifBitmapHandler {
+       const EXPENSIVE_SIZE_LIMIT = 10485760; // TIFF files over 10M are considered expensive to thumbnail
+
        /**
         * Conversion to PNG for inline display can be disabled here...
         * Note scaling should work with ImageMagick, but may not with GD scaling.
@@ -35,8 +37,7 @@ class TiffHandler extends ExifBitmapHandler {
         * InstantCommons will have thumbnails managed from the remote instance,
         * so we can skip this check.
         *
-        * @param $file
-        *
+        * @param File $file
         * @return bool
         */
        function canRender( $file ) {
@@ -50,8 +51,7 @@ class TiffHandler extends ExifBitmapHandler {
         * Browsers don't support TIFF inline generally...
         * For inline display, we need to convert to PNG.
         *
-        * @param $file
-        *
+        * @param File $file
         * @return bool
         */
        function mustRender( $file ) {
@@ -59,9 +59,9 @@ class TiffHandler extends ExifBitmapHandler {
        }
 
        /**
-        * @param $ext
-        * @param $mime
-        * @param $params
+        * @param string $ext
+        * @param string $mime
+        * @param array $params
         * @return bool
         */
        function getThumbType( $ext, $mime, $params = null ) {
@@ -99,4 +99,8 @@ class TiffHandler extends ExifBitmapHandler {
                        return '';
                }
        }
+
+       public function isExpensiveToThumbnail( $file ) {
+               return $file->getSize() > static::EXPENSIVE_SIZE_LIMIT;
+       }
 }