问题
please help. I can not understand why my loaded jpeg picture is determined by the wrong mime type
correct option must be image/jpeg
$mime_types = ['image/bmp', 'image/gif', 'image/jpeg', 'image/png'];
Validator::extend('is_image_array', function($attribute, $values, $params, $validator) use ($mime_types) {
foreach ($values as $k => $value) {
$f = finfo_open();
$result = finfo_buffer($f, base64_decode($value), FILEINFO_MIME_TYPE);
dd($f, $value,$result, $mime_types);
if ( !in_array($result, $mime_types)){
return false;
}
}
return true;
});
来源:https://stackoverflow.com/questions/62521824/why-may-not-the-type-of-mime-be-correctly-determined