图像未显示在blade.php文件中

时间:2020-08-05 04:30:26

标签: php html laravel laravel-blade

我尝试在刀片文件中显示图像,但是该图像无法显示,我编写了rigth链接,但仍未显示 这是我的代码

  @if ($post->image == 'NULL')
  <!-- foto usahakan di crop 3x2 landscape-->
      <a href="{{ route('showpost', $post->slug) }}" class="mb-4 d block">
         <img style="width: 400px; height: 240px; overflow: hidden;"
            src="https://image.shutterstock.com/image-photo/white-transparent-leaf-on-mirror-260nw-1029171697.jpg" 
            alt="Image" class="img-fluid">
      </a>
  @else
      <a href="{{ route('showpost', $post->slug) }}" class="mb-4 d-block"> 
        <img style="width: 400px; height: 240px; overflow: hidden;" 
             src="{{ $post->image_url }}" alt="Image" class="img-fluid">
      </a>
  @endif

有人知道出什么问题吗?

1 个答案:

答案 0 :(得分:0)

如果您已经完成了php artisan storage:link命令,请在src中输入您的路径,例如-:

<img style="width: 400px; height: 240px; overflow: hidden;" src="{{Storage::url('your_path/'.$post->image}}" alt="Image" class="img-fluid">