php Laravel 4 HTML 图像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16942243/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel 4 HTML images
提问by Rachael
My question is does Laravel accept PNG images or any other format beside JPG. What is happening is when I change my image to JPG it can find it, but as soon as I change it to PNG it no longer can find the image.
我的问题是 Laravel 是否接受 PNG 图像或除 JPG 之外的任何其他格式。发生的事情是,当我将图像更改为 JPG 时,它可以找到它,但是一旦将其更改为 PNG,它就再也找不到图像了。
{{HTML::image('images/DRCSportslogo.png', 'DRC Sports Race Management', array('id' => 'DRCS-logo'));}}
I have this image formatted in both PNG and JPG in the same file directory so I know it's not the location of the file.
我在同一文件目录中将此图像格式化为 PNG 和 JPG,所以我知道它不是文件的位置。
回答by Alencar Funini
The laravel search the image in the public folder, then you should have a file public/images/DRCSportslogo.png
Laravel 在 public 文件夹中搜索图像,然后你应该有一个文件 public/images/DRCSportslogo.png
{{ HTML::image('images/DRCSportslogo.png', $alt="DRCSports", $attributes = array()) }}
回答by kJamesy
Try
尝试
<img src="{{asset('images/DRCSportslogo.png')}}" alt="DRC Sports Race Management" id="DRCS-logo" />
回答by arma
There is no difference what you input there it can be .jpg, .png or even .exe or any other file on system.
您在那里输入的内容没有区别,它可以是 .jpg、.png 甚至 .exe 或系统上的任何其他文件。
You can see that in api page : L4 API HTML::image
您可以在 api 页面中看到:L4 API HTML::image
Only thing i can suggest is to browse directly to the image you want to reach. In my experience sometimes ftp clients make false uploads (empty png files). That could be the case.
我唯一可以建议的是直接浏览到您想要访问的图像。根据我的经验,有时 ftp 客户端会进行错误上传(空 png 文件)。情况可能是这样。
回答by niko
Try giving a permission to the "images" folder
尝试授予“图像”文件夹的权限