Add support to upload WebP files. Disabled by default and no thumbnailing support.
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 20 Oct 2010 14:50:30 +0000 (14:50 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 20 Oct 2010 14:50:30 +0000 (14:50 +0000)
Relates to bug 25397

RELEASE-NOTES
includes/MimeMagic.php
includes/mime.info
includes/mime.types

index cd30cd9..c89ede5 100644 (file)
@@ -181,6 +181,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   for versioning
 * Maintenance scripts get a --memory-limit option to override defaults (which
   is usually to set it to -1 to disable the limit)
+* (bug 25397) Allow uploading (not displaying) of WebP images, disabled by default
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive
index d86012c..7d7fedd 100644 (file)
@@ -402,6 +402,7 @@ class MimeMagic {
                        // Formats we recognize magic numbers for
                        'djvu', 'ogx', 'ogg', 'ogv', 'oga', 'spx',
                        'mid', 'pdf', 'wmf', 'xcf', 'webm', 'mkv', 'mka',
+                       'webp',
 
                        // XML formats we sure hope we recognize reliably
                        'svg',
@@ -548,6 +549,12 @@ class MimeMagic {
                        return "unknown/unknown";
                }
 
+               /* Look for WebP */
+               if( strncmp( $head, "RIFF", 4 ) == 0 && strncmp( substr( $head, 8, 8), "WEBPVP8 ", 8 ) == 0 ) {
+                       wfDebug( __METHOD__ . ": recognized file as image/webp\n" );
+                       return "image/webp";
+               }
+
                /*
                 * Look for PHP.  Check for this before HTML/XML...  Warning: this is a
                 * heuristic, and won't match a file with a lot of non-PHP before.  It
index 4999d81..3a32f5d 100644 (file)
@@ -19,6 +19,7 @@ image/x-portable-graymap image/x-portable-greymap     [BITMAP]
 image/x-bmp image/x-ms-bmp image/bmp application/x-bmp application/bmp [BITMAP]
 image/x-photoshop image/psd image/x-psd image/photoshop        [BITMAP]
 image/vnd.djvu image/x.djvu image/x-djvu [BITMAP]
+image/webp     [BITMAP]
 
 image/svg+xml application/svg+xml application/svg image/svg    [DRAWING]
 application/postscript [DRAWING]
index 4171d28..bf8c6dd 100644 (file)
@@ -85,6 +85,7 @@ image/svg+xml svg
 image/tiff tiff tif
 image/vnd.djvu djvu djv
 image/vnd.wap.wbmp wbmp
+image/webp webp
 image/x-cmu-raster ras
 image/x-icon ico
 image/x-ms-bmp bmp