Quick question for the RoR experts out there.
那里的RoR专家提出了快速提问。
I'm having a problem with getting the image_tag( ) method to properly format my HTML img element.
我在使用image_tag()方法正确格式化HTML img元素时遇到问题。
I'm pretty certain the reason my image will not load is because of the "/images/" directory that is being added to the front of the URL. (SEE BELOW)
我很确定我的图像无法加载的原因是因为“/ images /”目录被添加到URL的前面。 (见下文)
I'm calling the image_tag( ) method like this ::
我正在调用像这样的image_tag()方法::
I'm consuming MY method like this ::
我正在使用这样的MY方法::
This is the HTML tag that's getting generated ::
这是生成的HTML标记::
Anyone know why this /images/ directory is getting placed on the front of my URL?
任何人都知道为什么这个/ images /目录放在我的URL前面?
Thanks!
谢谢!
2 个解决方案
#1
2
Try changing https:/secure.gravatar.com... to https://secure.gravatar.com...
尝试将https:/secure.gravatar.com更改为https://secure.gravatar.com ...
Notice you have only one '/'
请注意,您只有一个'/'
#2
1
You have a syntax error in your URL.
您的网址中存在语法错误。
An example: If in my controller I use the following:
例如:如果在我的控制器中,我使用以下内容:
@my_image_url = "https:/localhost/desktop/02.png"
When I look at the generated page I get:
当我查看生成的页面时,我得到:
<img src="/images/https:/localhost/desktop/02.png" alt="bob">
If in my controller I use the following:
如果在我的控制器中我使用以下内容:
@my_image_url = "https://localhost/desktop/02.png"
When I look at the generated page I get:
当我查看生成的页面时,我得到:
<img src="https://localhost/desktop/02.png" alt="bob">
#1
2
Try changing https:/secure.gravatar.com... to https://secure.gravatar.com...
尝试将https:/secure.gravatar.com更改为https://secure.gravatar.com ...
Notice you have only one '/'
请注意,您只有一个'/'
#2
1
You have a syntax error in your URL.
您的网址中存在语法错误。
An example: If in my controller I use the following:
例如:如果在我的控制器中,我使用以下内容:
@my_image_url = "https:/localhost/desktop/02.png"
When I look at the generated page I get:
当我查看生成的页面时,我得到:
<img src="/images/https:/localhost/desktop/02.png" alt="bob">
If in my controller I use the following:
如果在我的控制器中我使用以下内容:
@my_image_url = "https://localhost/desktop/02.png"
When I look at the generated page I get:
当我查看生成的页面时,我得到:
<img src="https://localhost/desktop/02.png" alt="bob">