03 Jan 2009 11:59:53 UTC
- Distribution: File-Type-WebImages
- Module version: 1.01
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (2091 / 0 / 0)
- KwaliteeBus factor: 0
- 83.15% Coverage
- License: perl_5
- Activity24 month
- Download (7.13KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionMARKSTOS Mark Stosbergand 1 contributors
- Paul Mison - wrote original File::Type Mark Stosberg <firstname.lastname@example.org> - hacked up this.
File::Type::WebImages - determine web image file types using magic
use File::Type::WebImages 'mime_type'; my $type_1 = mime_type($file); my $type_2 = mime_type($data);
mime_type()can use either a filename, or file contents, to determine the type of a file. The process involves looking the data at the beginning of the file, sometimes called "magic numbers".
For minimum memory consumption, only the following common web image file types are supported:
BMP, GIF, JPEG and PNG. ( image/bmp, image/gif, image/jpeg and image/png ).
Unlike File::Type, we return "image/png" for PNGs, not "image/x-png";
If you want more mime types detected use File::Type or some other module.
It would be even better to have a pluggable system that would allow you to plug-in different sets of MIME-types you care about.
File::Type. Similar, but supports over 100 file types.
File::Type::WebImages is built from a mime-magic file from cleancode.org. The original can be found at http://cleancode.org/cgi-bin/viewcvs.cgi/email/mime-magic.mime?rev=126.96.36.199.
Paul Mison <email@example.com> - wrote original File::Type Mark Stosberg <firstname.lastname@example.org> - hacked up this.
Copyright 2003-2004 Fotango Ltd.
Licensed under the same terms as Perl itself.
Module Install Instructions
To install File::Type::WebImages, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install File::Type::WebImages
For more information on module installation, please visit the detailed CPAN module installation guide.