mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 14:52:24 +09:00
Storage::getContentType() 메소드를 MIME 클래스로 이동함
This commit is contained in:
parent
9163bc24e9
commit
805a7324cc
4 changed files with 36 additions and 36 deletions
|
|
@ -143,38 +143,6 @@ class Storage
|
|||
return @self::exists($path) && @is_writable($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MIME content type of a file.
|
||||
*
|
||||
* This method returns the MIME content type of a file, or false on error.
|
||||
*
|
||||
* @param string $filename
|
||||
* @return array|false
|
||||
*/
|
||||
public static function getContentType($filename)
|
||||
{
|
||||
$filename = rtrim($filename, '/\\');
|
||||
if (self::exists($filename) && @is_file($filename) && @is_readable($filename))
|
||||
{
|
||||
if (function_exists('mime_content_type'))
|
||||
{
|
||||
return @mime_content_type($filename) ?: false;
|
||||
}
|
||||
elseif (($image = @getimagesize($filename)) && $image['mime'])
|
||||
{
|
||||
return $image['mime'];
|
||||
}
|
||||
else
|
||||
{
|
||||
return MIME::getTypeByFilename($filename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of a file.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue