1File::Type::WebImages(3Upsme)r Contributed Perl DocumentaFtiiloen::Type::WebImages(3pm)
2
3
4
6 File::Type::WebImages - determine web image file types using magic
7
9 use File::Type::WebImages 'mime_type';
10
11 my $type_1 = mime_type($file);
12 my $type_2 = mime_type($data);
13
15 mime_type() can use either a filename, or file contents, to determine
16 the type of a file. The process involves looking the data at the
17 beginning of the file, sometimes called "magic numbers".
18
20 For minimum memory consumption, only the following common web image
21 file types are supported:
22
23 BMP, GIF, JPEG and PNG. ( image/bmp, image/gif, image/jpeg and
24 image/png ).
25
26 Unlike with File::Type and File::MMagic, 'undef', not
27 "application/octet-stream" will be returned for unknown formats.
28
29 Unlike File::Type, we return "image/png" for PNGs, not "image/x-png";
30
31 If you want more mime types detected use File::Type or some other
32 module.
33
35 It would be even better to have a pluggable system that would allow you
36 to plug-in different sets of MIME-types you care about.
37
39 File::Type. Similar, but supports over 100 file types.
40
42 File::Type::WebImages is built from a mime-magic file from
43 cleancode.org. The original can be found at
44 <http://cleancode.org/cgi-bin/viewcvs.cgi/email/mime-magic.mime?rev=1.1.1.1>.
45
47 Paul Mison <pmison@fotango.com> - wrote original File::Type Mark
48 Stosberg <mark@summersault.com> - hacked up this.
49
51 Copyright 2003-2004 Fotango Ltd.
52
54 Licensed under the same terms as Perl itself.
55
56
57
58perl v5.38.0 2023-07-20 File::Type::WebImages(3pm)