have you customised config/filesystem.php at all ?
have you sucessfully run php artisan storage:link ?
when you look in the public/storage folder do you see the exact same files and folders as storage/app/public? ( you should)
I have an issue of which I can't quite understand the concept of storage:link and viewing images. Now I know it makes a url for it to be shown, but that URL doesn't exist for me, even though it gets pushed to the front end.
This is what i'm talking about.
<img src="{{ Auth::user()->getImageUrl() }}" alt="Profile Image" class="w-64 h-64 bg-white rounded-xl">
Okay so i'm calling the getImageUrl method from the authenticated user. Now let's see that function.
public function getImageUrl(): string
{
if ($this->image) {
return asset('storage/' . $this->image);
}
return 'https://ui-avatars.com/api/?name=' . urlencode($this->name);
}
So it retrieves the the image of the authenticated user and parses it as an url, otherwise it just generates the random initials of the account name.
In my database the image is stored as images/{filename.extension}.
if ($request->hasFile('image'))
{
$path = $request->file('image')->store('images');
$user->update([
'image' => $path,
]);
return redirect()->route('profile', $user->username);
}
My question is why isn't the url generation working or not recognising. is there something i'm doing wrong?
have you customised config/filesystem.php at all ?
have you sucessfully run php artisan storage:link ?
when you look in the public/storage folder do you see the exact same files and folders as storage/app/public? ( you should)
Please or to participate in this conversation.