skip to Main Content

Here is the code for saving the images in the “storage“` folder

   $ImageName =  time() .  "." .$request->file('image')->getClientOriginalExtension(); 
   // gives you image name with extension
   $path = $request->file('image')->storeAs('public/Inward', $ImageName); 
   // image path
             

the image saved in the storage folder is not showing in the lightgallery

Any help would be appreciated

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    i was making the mistake while passing the path of the image in img tag

    Here is the code

    <span class="spnImg" data-sub-html="{{$item->Subject}}" 
    data-src="{{ asset('storage/Inward/'.$item->ImageLink)}}">
    <a href="{{ asset('storage/Inward/'.$item->ImageLink)}}"> View </a>
    <img class="img-responsive" src="{{ asset('storage/Inward/'.$item->ImageLink) }}" 
    style="display:none" alt="" /> </span>
                                       
    

  2. If the image is saved successfully in the storage folder but not showing in the lightgallery, there could be a few potential reasons for this issue. Here are a few troubleshooting steps you can try:

    1. Verify the image path: Check the path of the image that you’re passing to the lightgallery. It should be the correct path to the stored image in the storage folder.

    2. Symbolic link: By default, Laravel does not create a symbolic link from the public folder to the storage folder. You can create a symbolic link using the following command in your terminal:

      php artisan storage:link
      

      This command will create a symbolic link from the public/storage directory to the storage/app/public directory. Ensure that the image path in the lightgallery points to the correct location, i.e., public/storage/Inward/image.jpg.

    3. Permissions: Check the permissions of the storage folder and its subdirectories. Ensure that the web server (e.g., Apache or Nginx) has the necessary read permissions to access the images in the storage folder.

    4. Cache: If you have recently made changes to your code or images, your browser may be serving a cached version of the page. Try clearing your browser cache or accessing the page in a private browsing window to see if the image appears.

    If none of these steps solve the issue, please provide more details about your implementation, such as the code used to display the images in the lightgallery, any error messages you are encountering, or any additional relevant information.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search