Image not showing using spatie media library

  Fri 15 / 12 / 2023

  Posted by: Talha Manzoor

Category : Laravel

Tags : laravel , php laravel , backend

Post Thumbnail
Description

On dd() image path is showing and the image is also getting, but not showing the image.

Thanks in advance!



View Code
                        {{-- image --}}
                <div class="col-12 text-center">
                    <img src="{{ $post->getFirstMediaUrl('post') ?: asset('storage/default-post-thumbnail.png') }}"
                         alt="post image" class="img-fluid" style="max-height: 250px;">
                </div>
                
  Answered by CDL

Sure, let's double check the image path with name using inspect element.


If you don't know how to do it, I am attaching a screenshot to give you an idea how you can debug it.




See the picture link and open it into the new tab if the picture is opened it's mean your path is correct otherwise it's wrong if you are getting 404 resposne.

  Comment   Share
0 Likes   1 Comment


comment-author
Hadayat Niazi Super Admin

@Talha Manzoor please provide the directory structure like public/image/imageName.png and share the inspect element image path, so we will be able to respond correctly.



Reply


commented 11 months ago