you need to be able to create a symlink from storage/app/public to your external, public area
Displaying stored images on shared hosting
I have successfully deployed my first laravel application on a live server. Everything looks great except the fact that I am unable to display the images that are being uploaded to the storage/app/public/myfolder1 folder.
Here is my folder hierarchy on HostGator:
/myproject_src/ : Here are all the laravel source files (except the public folder)
/public_html/mydomain.com/ : Here goes all my contents of the public directory
I am storing the file path into the database in the following manner:
public/myfolder1/FxEj1V1neYrc7CVUYjlcYZCUf4YnC84Z3cwaMjVX.png [This path is associated with the image that has been uploaded to storage/app/public/myfolder1/ this folder]
What should I do in order to display the images properly in a img tag:
<img src="{{ how to point to the uploaded image here }}">
@helpmyworld Yes I had. If my memory serves me correctly, this is what I had to do in order to display the images:
-
In my filesystems.php file, I had changed the storage path of the
localdriver from'root' => storage_path('app')to:'root' => '/home3/tanmay/public_html/mydomain.com/storage/app'. -
Then I referred to the images like this:
<img src="{{ asset('storage/app/public' . str_replace('public','',$image->imgsrc)) }}" alt="{{ $ad->name }}" class="img-responsive img-thumbnail" height="200" width="200"> -
storage/app/public/myfolder1directory is where I used to store the images
Please or to participate in this conversation.