mardi 2 juin 2020

images are not loading in the view laravel 7

images was working just fine, my collaborateur in git messed the project up , so i'am now using the recovery project and images are not showing anymore here's my code everything was working

my store method

 if ($request->hasFile('avatar')) {
            // Get filename with the extension
            $filenameWithExt = $request->file('avatar')->getClientOriginalName();
            // Get just filename
            $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
            // Get just ext
            $extension = $request->file('avatar')->getClientOriginalExtension();
            // Filename to store
            $fileNameToStore = $filename . '_' . time() . '.' . $extension;
            // Upload Image
            $path = $request->file('avatar')->storeAs('public/avatars', $fileNameToStore);
        } else {
            $fileNameToStore = 'noimage.jpg';
        }







        $member = new Member;
   // others attributes 

        $member->avatar = $fileNameToStore;

        $member->save();

my view file

<div class="image-container">
                <img src="/storage/avatars/" class="avatar img-responsive" alt="avatar">
            </div> 

its show no erros , the files are in the correct folder after the create but images are not showing



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire