问题
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") }}
which yields
http://dev.local/public/images/storage/1_thy9WFfBw.jpg
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
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?
回答1:
Try this instead:
{{ HTML::image(asset('images/storage/' . $user_upload->image . '.jpg')) }}
回答2:
{{ HTML::image("images/storage/$val->user_upload".".jpg", $alt="not found") }}
If you are not still getting remove the .".jpg" extension because you might be storing file with extension
来源:https://stackoverflow.com/questions/23355289/laravel-4-public-directory-being-treated-as-a-route-image-not-showing