|
użytkowników online: 37
|
OPINIE UŻYTKOWNIKÓW
|
Prawdziwa skarbnica wiedzy na temat tworzenia stron WWW i nie tylko. Korzystam z porad praktycznie codziennie, jest mi to niezbędne w mojej pracy. Sam zajmuję się tworzeniem serwisów, ale porady pisane przez Darka sa dla mnie nieocenioną pomocą! Proste, czytelne i zrozumiałe dla każdego! Czekam na więcej!
Krzysztof Szypulski
KESS - projektowanie stron
|
|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
LXXI. Mimetype Functions| Ostrzeżenie |
This extension has been deprecated as the PECL extension
fileinfo
provides the same functionality (and more) in a much cleaner way.
|
The functions in this module try to guess the content type
and encoding of a file by looking for certain
magic byte sequences at specific
positions within the file. While this is not a bullet proof
approach the heuristics used do a very good job.
This extension is derived from Apache mod_mime_magic,
which is itself based on the file
command maintained by Ian F. Darwin. See the source code for
further historic and copyright information.
Do zbudowania tego rozszerzenia nie są wymagane
żadne zewnętrzne biblioteki.
You must compile PHP with the configure switch
--with-mime-magic to get support for
mime-type functions. The extension needs a copy of the simplified
magic file that is distributed with the Apache httpd.
Notatka:
The configure option has been changed from
--enable-mime-magic
to --with-mime-magic since PHP 4.3.2
Notatka:
This extension is not capable of handling the fully decorated
magic file that generally comes with
standard Linux distro's and is supposed to be used with
recent versions of file command.
Note to Win32 Users:
In order to use this module on a Windows environment, you must set the path
to the bundled magic.mime file in your php.ini.
Przykład 1. Setting the path to magic.mime mime_magic.magicfile = "$PHP_INSTALL_DIR\magic.mime" |
|
Remember to substitute the $PHP_INSTALL_DIR for your actual
path to PHP in the above example. e.g.
c:\php
Na działanie tych funcji wpływają ustawienia zawarte w pliku
php.ini.
Tabela 1. Mimetype configuration options | Name | Default | Changeable | Changelog |
|---|
| mime_magic.magicfile | "/path/to/php/magic.mime" | PHP_INI_SYSTEM | Available since PHP 4.3.0. |
Szczegóły i definicje dotyczące stałych
PHP_INI_* znajdują się w rozdziale Dodatek H.
To rozszerzenie nie posiada żadnych rodzajów zasobów. To rozszerzenie nie posiada żadnych stałych.
User Contributed Notesaidan at php dot net
29-Jan-2006 09:39
hans at lintoo dot dk
02-Jul-2005 03:22
When using fileinfo, I had a *lot* of problems with the mime file.
Using Apache2, FreeBSD and PHP5, I had no mime file is supply the fileinfo. So I had to use a custom mime file from a previous distribution of Apache, the files can be downloaded from here:
http://www.lintoo.dk/public/magic
and
http://www.lintoo.dk/public/magic.mime
It seems that both files are needed, although only one is supplied for fileinfo.
I used it for my file object:
<?php
$info = new finfo(FILEINFO_MIME,"./magic");
$this->fileType = $info->file($openpath);
?>
Should be rather self-explanatory, just remember to provide the path to the magic file as the second parametre when creating the fileinfo object.
I hope the originial creators of the magic files do not mind i uploaded them to http://lintoo.dk/ and share them with you. I mean no disrepect, but I cannot remember where I got the files.
blaine at blainegarrett dot com
03-Jun-2005 12:35
Some documentation on the Fileinfo PECL lib.
Didn't seem like the main site had much of anything in the way of examples, but i could be blind.
http://wiki.cc/php/Fileinfo
snarkles
23-Apr-2005 04:40
Here's an example from the source for people trying to get the fileinfo extension working with PHP 4:
<?php
$res = finfo_open(FILEINFO_MIME); $files = glob("*");
foreach ($files as $file) {
echo finfo_file($res, $file) . "\n";
}
finfo_close($res);
?>
vpopmail at engepel dot com dot br
19-Apr-2005 03:29
If you're going to install the fileinfo pecl package in a RedHat Linux 9.0 the installation will fail because the needed libmagic files are not installed by default.
They are part of the 'file' package. Even if you have file-3.39-9.rpm it doesn't provide the libraries.
You can obtain the original author's latest version of 'file' by anonymous FTP on ftp.astron.com in the directory /pub/file/file-X.YY.tar.gz.
Just extract, compile and install it in /usr/local (its default location) and you can proceed with fileinfo installation.
a big hug,
bruno negr
|