Laravel 4-将公共目录视为路由-图片未显示 [英] Laravel 4 - public directory being treated as a route - image not showing

查看:43
本文介绍了Laravel 4-将公共目录视为路由-图片未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Laravel 4的观点有这个问题. view.blade.php中的代码是:

I have this problem with Laravel 4's view. The code in view.blade.php is:

{{ HTML::image("public/images/storage/$user_upload->image.jpg") }}

产生

http://dev.local/public/images/storage/1_thy9WFfBw.jpg

那是正确的图像位置,但是当框架访问它时,它证明是不可访问的(即抛出HttpNotFound异常).查看屏幕截图: http://imgur.com/kKLu30L

That is the correct image location, yet as being accessed by the framework, it turns out to be not accessible (i.e. HttpNotFound exception thrown). See screenshot: http://imgur.com/kKLu30L

我认为该框架以某种方式将此URL视为路由资源,而不是公共资产.

I think the framework somehow treats this URL as a route resource rather than a public asset.

反正我可以解决这个问题吗?

Is there anyway I could work this out?

推荐答案

尝试以下方法:

{{ HTML::image(asset('images/storage/' . $user_upload->image . '.jpg')) }}

这篇关于Laravel 4-将公共目录视为路由-图片未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆