Sometimes, while using a Bagisto application,Headless eCommerce, Marketplaces or even after making any server side changes broken image may appears.
This problem with images is pretty common and can really mess up how users feel about your store.
These issues often happen because of wrong storage links, settings that aren’t set up right, or cache problems that haven’t been fixed.
This guide explains the common causes of and provides step-by-step solutions to resolve the issue effectively.
Common Causes of Broken Images
The problem with broken images in Bagisto usually happens for these reasons:
- We didn’t run below storage command on the root of the project folder.
|
1 |
php artisan storage:link |
- Sometimes specified wrong APP_URL path in .env file.
- Sometimes we have renamed our Bagisto project folder after the running above storage command.
- So you can fix the image broken issue by the below steps.
Solutions to Fix the Issue
Step A: Verify APP_URL path in .env Configuration
Use code blocks for URLs and commands
For local setup:
|
1 |
APP_URL=http://localhost/bagisto/public |
If using php artisan serve:
|
1 |
APP_URL=http://127.0.0.1:8000 |
or
|
1 |
APP_URL=http://localhost:8000 |
After updating, run:
|
1 |
php artisan config:cache |
Step B: Remove Existing Storage Link
Navigate to the root directory of your project and remove the existing storage link:
|
1 |
rm -rf public/storage |
Step C: Recreate Storage Link
Now recreate the symbolic link using:
|
1 |
php artisan storage:link |
Step D: Clear Cache
If the issue still persists, clear all caches:
|
1 2 3 4 |
php artisan config:clear php artisan view:clear php artisan cache:clear php artisan vendor:publish --force |
Thank you for reading this tutorial. We hope you found it helpful.
If you are facing any problems, feel free to drop a comment below—we’re ready to assist!
Feel free to hire Laravel developer to build your custom solutions on laravel.
To find out about the extensions you can use, take a look at Bagisto Extensions.