After deploying: images are missing. Path probably wrong?
Hi together!
I have a little trouble with some configurations after deploying my project to a shared server. My images are not found/shown anymore. While the css is showing all fine, there are no pictures anymore. I made a symlink by calling php artisan storage:link. I tested it. Worked fine in my file manager. Thus there must be an fail in the configuration of my storage path. While uploading new pictures it saves/creates correct paths in the storage folder. The images are on the right places.
in my blades img-tags like:
{{ asset('/storage/images/fotos/'.$item->com_id.'/'.$item->bw_id.'/'.$img->fotoname)}}
The problem is, storage is not accessible on the web. To make them accessible from the web, you should create a symbolic link from public/storage to storage/app/public. you can take a look at php artisan storage:link for creating a symbolic link. once the symblic is created used
asset('storage/file.txt');. remove the / infront of the storage. you sould have something like {{ asset('storage/images/fotos/'.$item->com_id.'/'.$item->bw_id.'/'.$img->fotoname) }}
Yeah, that's correct. Sorry about my wrong structure shown before. Now I updated it. My images are placed above the public_html... But why the images aren't shown, while the css is working?
My folder structure is correct at all. project-core parallel to the public_html. The index ist also correct. The page is working, the storage writable (Upload is working), database connection is workin, mail configurations are fine, the symlink correct. The css is working, the fonts are correct... There are only the images which aren't shown.
But if on shared I'd suggest just put them under public_html.
Just put the correct URL in that asset helper.
I have used the asset helper for quite a while now, and really never had any problems. But yes there's a couple times I had to use a little trial and error and get the url resolved correctly.
@jlrdw on this host symlinks are enabled and its supporting laravel. Via ssh I could properly create one with success. Thank you anyway. Have a nice weekend
@snapey I get an 403 error by putting the img-url in my browser... could it be that the symlink contains the full absolute path to the storage/app/public folder? How could I fix it?
Edit: ls storage gives me the correct folders in blue...
@snapey but then I would have no access to the entire page, isn't it? The webroot for the page is public_html/project, so the image path is shown as www.example.com/storage/image/fotos/34/1025/IMG-15235.jpg, the symlink is at public_html/project/storage to the linkpath project-folder/storage/app/public. Thus for me everything seems to be fine.
please correct me, if I didn't undersood your hint.
the ssh call readlink is give back an absolute path... is that ok? shouldn't it be not a rel path?
Am facing this ugly experience currently on my web. I have done the above suggestion but I dont really know why all of a sudden all the images disappears. But when I make new post the image remains but old images are gone.
Please any other possible suggestion for me?