Good day,
I am doing on Java with Struts2 framework. The below is my html code :
<html:image alt="Calendar" src="/images/icon_calendar.gif" />
<img alt="Calendar" src="/images/icon_calendar.gif" />
The first line of my image is working fine, the image is show correctly in my web page. ()
However, the second line of my html is not working. It is showing broken image in my web page. ()
Would like to ask, what mistake in my code.
Kindly advise.
Good day,
The problem is solved once I have post this question.
I have tried to solved it for few days.
The correct code should be as follow:
<html:image alt="Calendar" src="/images/icon_calendar.gif" />
<img alt="Calendar" src="images/icon_calendar.gif" />
Related
i have a porlet running in liferay portal.after successfully entering the details , i want to download the details in an html page , in which i have to include an image.
this is done by giving the absolute path as:
<img src="http://localhost:8080/Demo-portlet/images/logo-1.jpg"
and it works fine.
My portlet structure is :
Demo-portlet-->docroot-->images-->logo-1.jpg
Now i want to do this by using relative path. i tried as below but it didnt work out:
<img src="../Demo-portlet/docroot/images/logo-1.jpg" />
<img src="./docroot/images/logo-1.jpg" />
<img src="./images/logo-1.jpg" />
None of the above worked. please tell me how this can be done.
Adding the html path:
Demo-portlet-->docroot-->download.html
Try this:
<img src="images/logo-1.jpg" />
Your portlet can be embedded on random pages. It's the page's URL that you need to be relative to, not the portlet.
If you have your portlet on http://localhost:8080/web/guest/home or http://localhost:8080/web/guest/about-us/contact/addresses, the relative address would need to be different. Thus I'd recommend to be relative with regards to the server name, but not with regard to the embedding URL: At development time you have no clue what name the pages that embed your portlet will have.
Go with <img src="/Demo-portlet/images/logo-1.jpg" /> or look up the servlet context (e.g. replace "/Demo-Portlet" with a dynamic value, so that you don't have to hard-code it).
(sorry, IDE not running and I'm always mixing up if it's request.getServletContext() or something else - try for yourself and comment here, I'll edit this answer when you give the full code). The dynamic stuff - on a jsp - would be <img src="<%=request.getServletContext()%>/images/logo-1.jpg" />
I am using a HTML source editor to type and add images... The code I used to edit the font works perfectly fine, and so do the images..... but once I save and view my actual page http://www.youcaring.com/tuition-fundraiser/help-shelby-with-college/219039, the font is still correct, but the images don't display, they don't use the alt either, the img codes are simply showing fully as text. I'm not sure why the images show up IN the editor, but not on the main page.
I tried adding !doctype html and different ones for xhtml.. with the appropriate html, head, title, body tags and endings... but every time I save and view the page, the images are still only posted as text, and when I go to re-edit the code, the !doctype stuff I added as been automatically deleted.
I also tried changing any " < and > to " < and > but still no luck.
I have the proper end tags on my img codes as well />
All the images are proper http links and they are all working. I don't know what to try next!
Like mentioned earlier, the code works perfectly when it is in the text editor... and also when plugged into w3schools.com's tryit editor... but it doesn't work on the actual page I'm trying to put it on. Here is the img code:
<div style="text-align: center;">
<img src="http://www.icandog.org/files/image/bristol-thank-you.jpg" alt="Thank You" width="500" /><br /><br />
<img src="http://25.media.tumblr.com/tumblr_m6rmkgje1w1ry7wi4o1_500.gif" alt="Thank You" width="500" /><br />
</div>
Here is what the img codes are showing up as: http://static.tumblr.com/rvqsweo/DrFnac1we/example.jpg
In your source code I found something like the following:
<img src="http://www.icandog.org/files/image/bristol-thank-you.jpg" alt="Thank You" width="500">
Instead of the diamond operator you used the entity reference of < and > in all the img elements. Change
> and <
To
> and < respectively and it will solve the issue
so I have a strange request. I've been working on some security project for school, and I've been able to successfully inject some html code using a form on our test site. What's interesting is that it only accepts the html code as one line and with no spaces. This brings me to my question, so far I've only been able to get text and font color changes to work. But I want to see if someone could inject images/audio/video.
I'm trying to figure out how to turn this:
<img src="http://www.rtur.net/blog/image.axd?picture=2011%2F12%2Fcss.png"/>
Into this:
<imgsrc="http://www.rtur.net/blog/image.axd?picture=2011%2F12%2Fcss.png"/>
but add a space with code.
I've tried adding the but that only works with actualy text and not the tag itself. Any help is appreciated.
Interesting note: I was able to inject <font size="50" color="red"></font>
But I have no idea why that works but the image doesn't.
Have you tried the following?
A slash:
<img\ src="http://www.rtur.net/blog/image.axd?picture=2011%2F12%2Fcss.png"/>
Using a non-traditional closing tag:
<img src="http://www.rtur.net/blog/image.axd?picture=2011%2F12%2Fcss.png"></img>
Injecting a blank <img> tag:
<img src=""/>
Here's another solution: Try inline CSS:
<div style="background:url(http://www.rtur.net/blog/image.axd?picture=2011%2F12%2Fcss.png);height:400px;width:400px"></div>
See this fiddle: http://jsfiddle.net/9MYrM/
I'm a newbie in ruby so please ignore my little mistakes ;)
Im trying to show an image in a View and everything works fine except the path of the image I gave to img's src attribute, I'm using Rails 4 and as a default web project tree in Rails my project has following directories
app
config
db
public
and some other…
my image is in "app\assets\images\file.jpg"
And i Have coded this line in my html file.
<img src="/app/assets/images/file.jpg" alt="image" />
But image doesn't load on the page!!!
When I check it in "firebug" I found the request of:
"http://localhost:3000/app/assets/images/file.jpg"
this request exactly means "public\app\assets\images\file.jpg"
and clearly is not my path! and even does not exist.
What should I code for src's value to make it!?
Try this:
<img src="<%= asset_path("file.jpg") %>" alt="image" />
I have my image placed in a folder called images in the netbeans web pages folder and the link to it in my jsp is in a div as shown below:
<div id="image">
<p>
<img src="${pageContext.request.contextPath}/images/vote_image.GIF"
alt="banner"
width=600px
height=300px
/>
</p>
</div><!--end of image div-->
The problem is the image just doesn't load in the browser. What could be the problem? I used the same code in linux and it used to load the image. Could it be a browser problem, I'm using firefox 3.6 which I don't think should have a problem. Please let me know if any one has a clue as to why this is happening. If the problem is my code let me know how to adjust. Thank you
There are no units used in HTML width and height attributes.
<img src="${pageContext.request.contextPath}/images/vote_image.GIF"
alt="banner"
width="600"
height="300"
/>
Without seeing the rendered source of the page, I'd guess that's your problem. If not, try inspecting your image in Firebug and post what its rendered source looks like.
Also, make sure case sensitivity is not in play: gif vs. GIF.