Level 102
Why are you streaming in instead of just saving it directly?
https://laravel.com/docs/8.x/requests#storing-uploaded-files
i uploaded a gif image but it is not playing in the laravel blade view.
my controller code
$this->validate($request, [ 'name' => 'required', 'image' => 'required|mimes:jpg,png,bmp,jpeg,gif', ]);
$slug = Str::slug($request->name, '-');
$image = $request->image;
$imageName = $slug . '-' . uniqid() . Carbon::now()->timestamp . '.' . $image->getClientOriginalExtension();
if (!Storage::disk('public')->exists('banner')) {
Storage::disk('public')->makeDirectory('banner');
}
$img = Image::make($image)->stream();
Storage::disk('public')->put('banner/' . $imageName, $img);
$banner = new Banner();
$banner->name = $request->name,
$banner->image = $imageName;
$banner->save();
my blade view:
Please or to participate in this conversation.