图像未在视图中显示(laravel 5.2)

时间:2016-10-08 09:58:14

标签: php laravel laravel-5.2 laravel-routing

我正在使用laravel 5.2。我正在建立一个帖子系统,用户通过点击给定的图像对其进行评论。

正确获取图像的路径,但它不会显示在视图中。此外,视图中没有给出错误。

我的控制员:

public function createemoji($action,$statusId)
{


    $path=('/images/'.$action.'.gif');





   $request=new storage();
    $request->comment=$path;
    $request->user_id=Auth::user()->id;
    $request->post_id=$statusId;
    $request->save();









     $storage=storage::where(function($query) use($statusId)
     {
         $query->where('post_id',$statusId)
            ;
    })
    ->orderBy('created_at','desc')->get();
    dd($storage);

  return redirect()->back()->with('storage',$storage);
}

我的观点:

<a href="{{route('createemoji',['action'=>'6796','statusid'=>$post->id])}}" id="6796" class="btn btn-sm"><img id="z1" src="/images/6796.gif" name="one"/></a>

我试图展示的方式:

  @foreach($storages as $storage)
   @if($storages==$post->storage)


<div class="row">
<section class=" col-md-offset-3 col-md-5">

<h4 id="h45"></h4>
<img src="{{ $storage->comment }}">


</section>
</div>


 @endif
@endforeach

1 个答案:

答案 0 :(得分:-1)

尝试 img-src 的完整路径,如下所示:

<img id="z1" src="www.yourdomain.com/images/6796.gif" name="one"/>

此外,您可以使用浏览器检查工具检查图像元素进行检查。例如,在chrome

相关问题