Hi. I have fresh installed Metronic Laravel. I tried to edit the avatar. The link is saved to the db, but the avatar not shown neither in the profile page or the navbar.
Hi Reza,
Could you please verify if the image is being uploaded properly? Please check it in the Laravel storage folder.
storage/app/public
Yes I have the images inside
storage/app/public/images
Hi,
Could you please check the browser console log if there is any error? Could you please send the screenshot?
Thanks
I got an upload success response. And for the console log, I only got error for the logo
Failed to load resource: the server responded with a status of 403 (Forbidden)
Got this message in both preview and response
"Failed to load response data: No content available because this request was redirected"
<img>https://ibb.co/f95dWnf
How can I upload a captured image here so it will be easier for you to see it
Upload succeed and image saved to the storage>images folder. But still not shown. Are there any other Metronic Laravel settings or Laravel classes I missed?
Any new updates?
I also tried to use the absolute image path to replace the img src link but not working
<img src="%7B%7B%20auth()->user()->avatar_url%20%7D%7D%22%20alt=%22image" class="w-100" alt="">
Hi Reza,
How about the folder permission? Have you tried to check on it? Could you please try to set some read-write permission for the storage folder? Here is some guidance for the Laravel folders.
https://stackoverflow.com/a/66109044
Thanks
Hi Faizal,
The app is still in local dev. And yes, the storage permission to read-write
I am using Laragon, if it helps for troubleshooting
I did have found the solution. I think it's related to the storage link command. Maybe you should check the default Metronic Laravel files for the avatar file routing. It will not work after running the storage link command since it will require the
asset
Sorry for the inconvenience. I hope this will help other users as well. We already put the step (no 14) in the documentation.
https://preview.keenthemes.com/metronic8/laravel/documentation/getting-started/build
Thanks
Hi Reza,
I have the same problem.
Please, how to solve the problem?
Remove the access to storage in public folder
Then "php artisan storage:link"
I tried all the solutions but still facing the same issue...The image is being uploaded to 'public/app/avatars'.
This is the code in the settings controller:
$file = null;
if (request()->hasFile($key)) {
// $file = Storage::disk("public")->putFile($folder, request()->file($key), "public");
if( request()->hasfile($key) )
{
$file = request()->file($key);
$extension = $file->getClientOriginalExtension();
$filename = $key . auth()->user()->name . "." . $extension;
$file->move("app/avatars/", $filename);
$key = $filename;
}
return $file;
}