【问题标题】:How can i store image and display it in webpage from database in laravel 4如何在 laravel 4 的数据库中存储图像并将其显示在网页中
【发布时间】:2015-06-01 08:50:06
【问题描述】:

我想将图像存储在现有表格的列中。然后我想在我的网页中显示它。我该怎么做?谁能帮帮我。我可以存储图像路径,但无法将图像移动到该文件夹​​。所以我无法理解如何在网页中显示此图像。

提前致谢

【问题讨论】:

    标签: php database laravel-4


    【解决方案1】:

    为了更好地理解,您可以点击此链接:storing image in a existing table column and display it using laravel 4

    或遵循以下规则

    使用如下表格

    {{ Form::file('image', ['class' => 'form-group']) }}
    

    对于存储使用以下方法:

    $name = Input::file('image')->getClientOriginalName();
    Input::file('image')->move('public/images',$name);
    $destinationPath = '/images/'.$name;
    

    为了在网页中显示它在刀片模板中执行如下操作

    {{ HTML::image($post->image) }} 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-02
      • 2015-09-08
      • 1970-01-01
      • 2011-12-28
      相关资源
      最近更新 更多