Bastos's avatar

Update image show white square

Hello there, I'll need your help because when I display an image that I upload, it show a white square. I have a form that I use for a profil picture, It's working, I can upload the picture, BUT it show me a white square instead of the photo. That's html code :

                <img src="{{Auth::user()->images}}"/>
                <p>{{Auth::user()->firstName}} {{Auth::user()->lastName}}</p>
                <a href="{{ url('/my_account') }}">Mon compte</a> | <a href="{{ url('/logout') }}">Se déconnecter</a>
            </div>

And that's my ProfilePictureController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use Auth;


class ProfilePictureController extends Controller
{
    public function update(Request $request)
    {
        $request = $request->All();

            User::where('id', Auth::user()->id)
                ->update(
                    [
                        'image' => $request['image']]
                );
            return redirect()->to('/')->with(['image-changed' => 'Photo de profil modifiée !']);
        }

}

I don't know if my question was clear but ask if you need more informations. Thank you.

0 likes
6 replies
Bastos's avatar

@SUJANCSE - And it's called image, without an S , I changed it in my html file but nothing change

sujancse's avatar

Could you please show the dump of Auth::user()?

Bastos's avatar

@SUJANCSE - Sorry what do you mean by that, it's a specific file ? I'm kinda new to laravel I'm trying to understand all the features of it. Thanks for your time

Bastos's avatar

@SUJANCSE - Is that what you want ?

<form action="{{ route('profilePicture') }}" method="POST">
                            @csrf

                            <div id="profile-container">
                            <image id="profileImage" src="{{url('images/user.jpg')}}" />
                        </div>
                        <input id="imageUpload" type="file"
                               name="image" placeholder="Photo" accept="image/*"  capture>
                        <div class="form-group row mb-0" >
                            <div class="col-md-8 offset-md-4" >
                                <button type="submit"   class="btn btn-primary">
                                    {{ __('Enregistrer') }}
                                </button>
                            </div>
                        </div>
                        </form>
Bastos's avatar

Anyone has an idea on how to solve this ?

Please or to participate in this conversation.