I have been working on an open source project recently, currently I am just adding new features in the project.
The project has some images to retrieve and to display them in the view blade that is working perfectly but when I am trying to add a new image through the form, my images are not displaying.
What could be the problem
I have tried
php artisan storage:link
But without success
The issue is when you upload laravel application from one sever to another or from local to live server .It copies shortcut of storage folder too.So before you must delete shortcut folder from public/storage and symbolic link again.
To make these files accessible from the web, you should create a symbolic link from public/storage to storage/app/public.
php artisan storage:link
Ref:https://laravel.com/docs/8.x/filesystem#the-public-disk
Related
I copy project laravel to new hosting and new domain, its working fine. But the problem is when i upload new image, that image successfully upload to file storage/app/public/upload/folder, but that image not showing on page. See below image
You need to run: php artisan storage:link
to link storage to public folder
I'm saving image in Storage folder path is like:
storage\app\public\img\images_01.png
now in my vue component i'm getting image like this:
this is returning following path :
/storage/img/images_01.png
but the issue is image does not gets displayed.
You can only access files in your public folder. But you can add a symbolic link with php artisan storage:link so you can access what's in storage/app/public
so i just create a storage link with
php artisan storage:link
to store images and view them, but after i push it with github, the storage link seems to disappear on my partner's side, so he can only store and can't view, is there a way to fix this without doing the artisan command on his side
If your partner has no ssh/terminal access, then create symbolic link with Route, run it once & delete it.
route/web.php :
Route::get('/sym', function () {
Artisan::call('storage:link');
});
It's just a symbolic link that is created. Seeing that the base folder is not versioned during php artisan storage:link the symbolic link will also not be versioned. Your partners will have to face a php artisan storage:link at their level. However, it will not be able to access your files unless you decide to version the folder.
I developeded a Laravel web app, which works fine and great on local machine but
after going in production on a shared hosting server i have some issues displaying the logo and the website images using the asset() helper function.
However the css and js are accessible and works fine (also using the asset function).
I've deployed the App following the steps bellow:
I created a directory called repositories outside the public_html (the root document of mydomain.com) and i copied inside it directory soukelafalah (contining all the files of my laravel project)
I moved the laravel public directory files into the public_html directory
I edited the index.php in public_html as follow:
require DIR.'./../repositories/SoukElfalah/vendor/autoload.php';
$app = require_once__DIR__.'/../repositories/SoukElfalah/bootstrap/app.php';
I run php artisan storage:link and the link is succufully created
I had run also:
ln -s /home/dtruxpgw/repositories/SoukElfalah/storage/app/public /home/dtruxpgw/public_html/storage
The route and the css is working fine but the logo and the images are not displayed and shows a 404 error as shown in the image below.
So please, can any one point what i am missing?
And when i put asset('/storage/images/thumbs/'.$img_name)}}" am i pointing to the storage directory in the public_html or in the one in the public folder of my laravel app directory.
Thank you in advance.
I have deployed laravel application in heroku. I am storing images in storage folder of laravel and trying to fetch it by defining a route. It was working well on local, but when i trying to do the same on server, then its not showing the images. I thought that storage folder is inside the laravel, so it should work fine, but its not working.
Can i store images in public folder by creating a named folder "gallery" inside that and put that gallery folder in gitignore. so will the gitignore folder be vanished when i will push the laravel project again?
Other options are using another file system. Most of them are paid, so i was thinking to save the images in database, is that the good idea or i should move to files only.
First of all, the storage directory should have right permission.
You should create a symbolic link from public/storage to storage/app/public.
Create the symbolic link:
php artisan storage:link
You cannot save images in database, only their names or links etc. I implemented the same thing you did by naming the files to their path and storing that to the database and then using it to fetch the data from folder on sever