jeudi 18 juillet 2019

laravel5.8:GET 404 (Not Found)

I am using laravel 5.8 and laravel-medialibrary:^7.0.0.

I want to upload my image, and retrieve in profile edit page. But it doesn't work.

In my console, I got an error GET 'my image file' 404 (Not Found).

This is my code. I used this code after php artisan storage:link

show.blade.php(my profile edit view page)

<img src="" alt="">

also, I tried

<img src="" alt="">

ChannelController.php

public function update(Request $request, Channel $channel)
    {
        if($request->hasFile('image')) {
            $channel->clearMediaCollection('images');
            $channel->addMediaFromRequest('image')
            ->toMediaCollection('images');
        }

        $channel->update([
            'name'=> $request->name,
            'description'=> $request->description
        ]);

        return redirect()->back();
    }

Channel.php

public function registerMediaConversions(?Media $media = null)
    {
        $this->addMediaConversion('thumb')
            ->performOnCollections('images')
            ->width(100)
            ->height(100);
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire