Why the image is not showing on the browser?
Only not showing on localhost but showing on live host
localhost/storage/image/site-logo.png // localhost
site.com/storage/image/site-logo.png // live site
{{ asset('storage/'.$general_settings->site_logo) }} // code to display image
It seems like you're having trouble displaying an image stored on your server in the browser. There could be several reasons why the image is not showing up. Here are a few things you can check and try to resolve the issue:
Correct File Path: Ensure that the path to the image file is correct. If you're using Laravel, and the image is stored in the storage/app/public directory, you need to create a symbolic link to the public directory using the php artisan storage:link command. This will make the files in storage/app/public accessible from the public directory.
File Permissions: The image file should have the correct permissions to be readable by the web server. You can set the permissions using the chmod command in the terminal.
Correct Headers: Make sure that the server is sending the correct content-type header for the image. For example, for a PNG image, the header should be image/png.
File Exists: Double-check that the image file actually exists at the specified path and that there are no typos in the file name.
HTML Tag: If you're using an <img> tag to display the image, ensure that the src attribute is set correctly.
Here's an example of how you might display an image stored in the storage/app/public directory in a Laravel application:
// After running `php artisan storage:link`
// Your image might be accessible through the 'storage' folder in the public directory
// In your Blade template:
<img src="{{ asset('storage/image-name.png') }}" alt="Description of image">
If you're still having trouble, please provide more details about how you're trying to display the image, including any relevant code snippets, so that we can offer more targeted assistance.
@nelson_mutane btw this is my current app url on my local host
APP_URL=http://localhost and this is the url that load the page but not the image from storage
The issue is been resolved thank you for all the help
what I did is just run again
php artisan storage:unlink and link it again php artisan storage:link