mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 00:02:15 +00:00
- allow empty input
- allow svg avatar
This commit is contained in:
@@ -290,14 +290,20 @@ function store_avatar($request, $name)
|
||||
// Store avatar
|
||||
$image_path = Str::random(16) . '-' . $image->getClientOriginalName();
|
||||
|
||||
// Create intervention image
|
||||
$img = Image::make($image->getRealPath());
|
||||
if (in_array($image->getClientMimeType(), ['image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/webp'])) {
|
||||
// Create intervention image
|
||||
$img = Image::make($image->getRealPath());
|
||||
|
||||
// Generate thumbnail
|
||||
$img->fit('150', '150')->stream();
|
||||
// Generate thumbnail
|
||||
$img->fit('150', '150')->stream();
|
||||
|
||||
// Store thumbnail to disk
|
||||
Storage::put("avatars/$image_path", $img);
|
||||
// Store thumbnail to disk
|
||||
Storage::put("avatars/$image_path", $img);
|
||||
}
|
||||
|
||||
if ($image->getClientMimeType() === 'image/svg+xml') {
|
||||
Storage::putFileAs('avatars', $image, $image_path);
|
||||
}
|
||||
|
||||
// Return path to image
|
||||
return "avatars/$image_path";
|
||||
|
||||
Reference in New Issue
Block a user