Laravel 4 Laravel不显示图像

Laravel 4 Laravel不显示图像,laravel-4,Laravel 4,我无法在数据库中显示上载的图像。我想是因为我没有正确保存图像 在我的控制器中: if ( Input::hasFile('thumbnail') ) { $file = Input::file('thumbnail'); // Get the image input $destinationPath = 'uploads/images/thumbnails'; // The destination were yo

我无法在数据库中显示上载的图像。我想是因为我没有正确保存图像

在我的控制器中:

if ( Input::hasFile('thumbnail') ) {

            $file               = Input::file('thumbnail'); // Get the image input
            $destinationPath    = 'uploads/images/thumbnails'; // The destination were you store the image.
            $filename           =  time() . '_' . $file->getClientOriginalName() ; // Original file name that the end user used for it.
            $file               = $file->move($destinationPath, $filename); // Now we move the file to its new home.
            $input['thumbnail'] = $file->getRealPath();
        }

        $model = Model::create($input);
我试着展示这两件事,但都不管用:

<img src='{{ asset($model->thumbnail) }}'>
                    <!-- {{ HTML::image( $model->thumbnail, 'foto') }} -->
这是数据库上的路径:
/home/vagrant/code/myApp/public/uploads/images/thumbnails/1405976987_C360_2014-05-31-22-09-28-012。jpg

检查您的数据库表,确保缩略图的路径实际存储在数据库中,而数据库中很可能没有$destinationPath应该真正使用一个Laravel path助手,例如base_path,为您提供完全限定的路径。您的代码似乎也缺少其他部分的块。我编辑我的问题以显示数据库的路径。好的,这是您的文件的路径,但不是图像的可访问URL。您最好存储相对路径并将其转换为url。e、 g.您的相对路径应该是uploads/images/thumbnails/1405976987_C360_2014-05-31-22-09-28-012.jpg,将其保存在模型中作为$input['thumbnail\u url',并调用资产$model->thumbnail\u url。