lundi 31 août 2015

Load an image from an app directory in Laravel

In my app/ directory, I create sub directory call Files/

and I stored all my blogs img in there, now I tried to display in my blade, I couldn't. Is it even possible ?


I've tried

example of my image path

/app/Files/blogs/Test/img/Screen%20Shot%202015-08-31%20at%201.35.22%20PM.png


img tag

<img src="{{app_path()}}/Files/blogs/{{$blog->name}}/img/{{$blog->img_path}}">


Block of code

<ul class="portfolioContainer grid row no_left_right isotope">

        <?php

        use App\Blog;
        $blogs = Blog::all();

        ?>


        @foreach( $blogs as $blog)

        <li class="col-xs-12 col-sm-4 col-md-4 col-lg-4 isotope-item">
            <div class="lightCon">
              <figure>
                <div class="img_hover">
                <img src="{{app_path()}}/Files/blogs/{{$blog->name}}/img/{{$blog->img_path}}">

                </div>
                <figcaption>
                  <h4><a href="#">{!! $blog->name !!}</a></h4>
                  <div class="metaInfo"> <span>By <a href="#" class="admin"></a> </span> {{ $blog->user->username }}</span></div>
                  <p>{!! $blog->description !!}</p>
                </figcaption>
              </figure>
            </div>
          </li>

        @endforeach

      </ul>

Result,

enter image description here

Console Error enter image description here

Any suggestions / hints will be much appreciated.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UnQiRr
via IFTTT

Aucun commentaire:

Enregistrer un commentaire