验证是否图片
bool Core_Upload::is_image( )
bool
494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524public
function
is_image()
{
$png_mimes
=
array
(
'image/x-png'
);
$bmp_mimes
=
array
(
'image/bmp'
);
$jpeg_mimes
=
array
(
'image/jpg'
,
'image/jpe'
,
'image/jpeg'
,
'image/pjpeg'
);
if
(in_array(
$this
->file[
'type'
],
$bmp_mimes
))
{
$this
->file[
'type'
] =
'image/bmp'
;
}
if
(in_array(
$this
->file[
'type'
],
$png_mimes
))
{
$this
->file[
'type'
] =
'image/png'
;
}
if
(in_array(
$this
->file[
'type'
],
$jpeg_mimes
))
{
$this
->file[
'type'
] =
'image/jpeg'
;
}
$img_mimes
=
array
(
'image/gif'
,
'image/jpeg'
,
'image/png'
,
'image/bmp'
,
);
return
(in_array(
$this
->file_type,
$img_mimes
, true)) ? true : false;
}