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.
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;
}
Hi Reza,
Sorry for the delay. Have you found the solution to this issue?
Could you please check in the HTML inspector and check the image URL?
<img src="https://i.ibb.co/56BfhKQ/image.png" alt="image" border="0"><br /><a target='_blank' href='https://imgbb.com/'>ismail image</a><br />
Thanks
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"
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
We have to check what error cause it. Maybe you can try to check on this network log. If there is an error in the response, we can see it after submitting it.
<img src="https://i.ibb.co/k4ccN0v/image.png" alt="image" border="0">
Thanks
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
You can use embed code HTML from here.
<img src="https://i.ibb.co/ZBnbbDW/image.png" alt="image" border="0">
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="{{ auth()->user()->avatar_url }}" alt="image"/>
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)
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