【发布时间】:2020-11-25 05:35:59
【问题描述】:
我尝试在刀片文件中显示图像,但图像不显示,我写了正确的链接但仍然不显示 这是我的代码
@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
谁知道问题出在哪里?
【问题讨论】:
-
需要更多信息。哪个没有显示。默认值应该可以工作。所以我假设你遇到的问题是动态 $post->image_url?转储 var 时会得到什么?
{{dd($post->image)}} -
您的代码完美运行。刚刚检查了您在 {{$post->image}} 中得到的内容
标签: php html laravel laravel-blade