Webp MIME Type on Apache 2.4 using magic file

51 views
Skip to first unread message

richard....@gmail.com

unread,
May 19, 2015, 8:38:24 AM5/19/15
to webp-d...@webmproject.org
Does anyone have the lines to add to the Apache 2.4 'magic' file to define the webp mime type as image/webp?

Thanks in advance

Pascal Massimino

unread,
May 20, 2015, 2:55:53 PM5/20/15
to WebP Discussion
Hi,

On Tue, May 19, 2015 at 5:33 AM, <richard....@gmail.com> wrote:
Does anyone have the lines to add to the Apache 2.4 'magic' file to define the webp mime type as image/webp?

I'm not sure how to making Apache support  a new magic (it probably involves sending a patch somewhere).

But, as a starting point, here's how to make the 'file' command under Unix recognize some webp file more precisely
than just "RIFF" (which is the default).
In you /etc/magic file, just add the following specific entries:

# RIFF xxxx WEBP
0       string  RIFF
>8      string  WEBP    WEBP image format
>>12    string  VP8X
>>>30   string  ALPH    (with alpha)
>>12    string  VP8\    (lossy)
>>12    string  VP8L    (lossless)
!:mime  image/webp

I didn't list all the possible variations of header content, beside the common one (RIFFxxxxWEBP).
But this list should cover most common cases.

hope it helps,
skal
Reply all
Reply to author
Forward
0 new messages