Looking for ?

Translate

Laravel Error And Solution - Images Is showing on local but 404 error on live Server

Hello programmers, i am the Web master in wakabiang.com. If you are having this error in your laravel project, you have come to the right platform because i always post the error i have faced and the solution to it.



Note that the error you are facing is a configuration error and the below is the solution

1. I assume that i created a folder named core inside public_html and pasted my laravel project files inside public_html/core/


2. Create a folder inside public_html as public_html/storage/app/public


3. Now Navigate and open /public_html/core/config/filesystems.php


Adjust two(Public and Links) code set to look like below:

NOTE: Am trying to change the storage path so that our images can be store where it can be accessible.


 'public' => [

            'driver' => 'local',

            'root' => storage_path('../../../public_html/storage/app/public'),

            'url' => env('APP_URL').'/storage',

            'visibility' => 'public',

        ],


'links' => [

            public_path('storage') => storage_path('../../../public_html/storage/app/public'),    

    ],


4. From your Terminal, Run this command to see the folders / directories

COMMAND: ls


5. Run the below command to navigate to your laravel files

COMMAND: cd public_html/core


6. Run the below command to create a storage link.

COMMAND: php artisan storage:link


7. Go to your Model file(e.g Modes/User.php) that has the function that is returning your profile picture or image to your blade file and edit to below code

 public function profileImage(){

  $imagePath = blablabla

  return '/storage/app/public/'.$imagePath;

  }


Don't hesitate to ask your questions. If you are finding it difficult, we can assist you in your server from here.



SHARE THIS POST

About Wakabia

    Blogger Comment
    Facebook Comment

1 comments:

  1. Clients who experience endless specialized hiccups while riding the web on Google Chrome program are consistently in the pursuit of the master direction and where clients will likewise when they are worn out in the wake of endeavoring to tackle their issues all alone on an ongoing.err_too_many_redirects chrome

    ReplyDelete