mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 04:03:34 -08:00
trait base64 encoded files
This commit is contained in:
parent
e15159b9c3
commit
e846e6ac76
|
@ -5,10 +5,13 @@ namespace App\Http\Requests;
|
|||
use App\Models\SnipeModel;
|
||||
use Intervention\Image\Facades\Image;
|
||||
use enshrined\svgSanitize\Sanitizer;
|
||||
use App\Traits\ConvertsBase64ToFiles;
|
||||
use Storage;
|
||||
|
||||
class ImageUploadRequest extends Request
|
||||
{
|
||||
use ConvertsBase64ToFiles;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
|
@ -26,10 +29,11 @@ class ImageUploadRequest extends Request
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'image' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp',
|
||||
'avatar' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp',
|
||||
];
|
||||
|
||||
return [
|
||||
'image' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp',
|
||||
'avatar' => 'mimes:png,gif,jpg,jpeg,svg,bmp,svg+xml,webp',
|
||||
];
|
||||
}
|
||||
|
||||
public function response(array $errors)
|
||||
|
@ -37,6 +41,13 @@ class ImageUploadRequest extends Request
|
|||
return $this->redirector->back()->withInput()->withErrors($errors, $this->errorBag);
|
||||
}
|
||||
|
||||
protected function base64FileKeys(): array
|
||||
{
|
||||
return [
|
||||
'image' => 'auto',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle and store any images attached to request
|
||||
* @param SnipeModel $item Item the image is associated with
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
namespace App\Http\Traits;
|
||||
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Arr;
|
||||
|
|
Loading…
Reference in a new issue