Closed Temepest74 closed 11 months ago
I'm not sure if it helps, but here's what I'm doing currently:
'image' => [
'nullable',
new DataUri(),
'bail',
function ($attribute, $value, $fail) {
try {
$image = Image::make($value);
if (!$image || !str_starts_with($image->mime(), 'image/')) {
$fail('The '.$attribute.' must be an image.');
}
} catch (\Exception $exception) {
$fail($exception->getMessage());
}
}
],
Version 4 allows to check for mime-types.
The title. It will be so much helpful to have it already build in