mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
이미지, 동영상 첨부시 구분할 수 있도록 그 섬네일에 play 아이콘 추가 모듈별 파일 설정시 파일 모듈의 업로드 기본, 이미지, 동영상 설정을 각각 달리 적용할 수 있도록 기본 설정 제어 옵션 분리
46 lines
843 B
PHP
46 lines
843 B
PHP
<?php
|
|
|
|
namespace Rhymix\Framework;
|
|
|
|
/**
|
|
* The image class.
|
|
*/
|
|
class Image
|
|
{
|
|
/**
|
|
* Check Check if file is an image
|
|
*
|
|
* @param string $filename
|
|
* @return bool
|
|
*/
|
|
public static function isImage($filename)
|
|
{
|
|
return strtolower(array_shift(explode('/', @mime_content_type($filename)))) === 'image';
|
|
}
|
|
|
|
/**
|
|
* Get image information
|
|
*
|
|
* @param string $filename
|
|
* @return array|false
|
|
*/
|
|
public static function getImageInfo($filename)
|
|
{
|
|
if (!self::isImage($filename))
|
|
{
|
|
return false;
|
|
}
|
|
if (!$image_info = @getimagesize($filename))
|
|
{
|
|
return false;
|
|
}
|
|
return [
|
|
'width' => $image_info[0],
|
|
'height' => $image_info[1],
|
|
'type' => image_type_to_extension($image_info[2], false),
|
|
'bits' => $image_info['bits'],
|
|
'channels' => $image_info['channels'],
|
|
'mime' => $image_info['mime'],
|
|
];
|
|
}
|
|
}
|