Have you checked the permission of each individual file?
APP_URL is using http or https?
Try to remove the if statement and get the picture without it, maybe debug the code there to see if it's giving the image correctly.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Images stored in the public/storage directory are not displaying on the live server (shared hosting environment), but they work perfectly on localhost.
Trainee.php Method
public function getProfilePicture()
{
if ($this->picture && Storage::disk('public')->exists($this->picture) == 1) {
return Storage::disk('public')->url($this->picture);
}
return asset('/images/blank_profile_picture.png');
}
Blade Template
<img src="{{ $trainee->getProfilePicture() }}">
filesystems.php Configuration
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
],
],
Below are the commands I ran to set up the symbolic link for the storage directory:
php artisan storage:link
INFO The [public/storage] link has been connected to [storage/app/public].
chmod -R 755 storage
chmod -R 755 public/storage
After running the commands:
ls -l public
lrwxrwxrwx 1 user user 61 Dec 17 10:22 storage -> /home/customer/www/.../storage/app/public
... contains the app path that I'm passing in .env as APP_URL
storage/app/public/trainee-profile-pictures directory:ls -l storage/app/public/trainee-profile-pictures/
-rwxrwxr-x 1 user user 26990 Dec 17 07:36 gAgoBddnYT7SH0eiV2u000bqZT5j2TGQjcoedHlj.jpg```
The getProfilePicture() method in the Trainee.php model should return the correct URL of the image, and the <img> tag in the Blade template should display the image.
Actual image path:
/storage/app/public/trainee-profile-pictures/gAgoBddnYT7SH0eiV2u000bqZT5j2TGQjcoedHlj.jpg
Values observed during debugging:
$this->picture = trainee-profile-pictures/gAgoBddnYT7SH0eiV2u000bqZT5j2TGQjcoedHlj.jpg
Storage::disk('public')->exists($this->picture) = 1
$trainee->getProfilePicture() = https://.../storage/trainee-profile-pictures/gAgoBddnYT7SH0eiV2u000bqZT5j2TGQjcoedHlj.jpg
storage_path('app/public/'.$this->picture) =
/home/customer/www/.../storage/app/public/trainee-profile-pictures/gAgoBddnYT7SH0eiV2u000bqZT5j2TGQjcoedHlj.jpg
I want to know
Please or to participate in this conversation.