Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image in ASP

Status
Not open for further replies.

tomothy

Technical User
Oct 30, 2001
40
GB
Hello,

does anyone know why the below code would not display my image. I have tried everything I can think of but it just wont work. Help me please!!!

Thanks
Andrew

<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim strImgPath
strImgPath = (Server.MapPath(&quot;images\&quot;))
Response.Write (strImgPath)
Response.Write (&quot;<p>&quot;)
Response.Write (&quot;<img scr=&quot;&quot;&quot;) & (strImgPath) & (&quot;admin-logo.jpg&quot;&quot; width=&quot;&quot;333&quot;&quot; height=&quot;&quot;175&quot;&quot;>&quot;)
%>
 
Try

<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim strImgPath
strImgPath = (Server.MapPath(&quot;images\&quot;))
Response.Write (strImgPath)
Response.Write (&quot;<p>&quot;)
Response.Write (&quot;<img scr='&quot;) & (strImgPath) & (&quot;admin-logo.jpg' width='333' height='175'>&quot;)
%>

I think it was the use of double quotes The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Have you had a look at the HTML-source generated by your script?! This is not a bug - it's an undocumented feature...
;-)
 
<%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim strImgPath
strImgPath = (Server.MapPath(&quot;images\&quot;))
Response.Write (strImgPath)
Response.Write (&quot;<p>&quot;)
Response.Write (&quot;<img src=&quot;&quot;&quot; & strImgPath & &quot;admin-logo.jpg&quot;&quot;&quot; width='333' height='175'>&quot;)
Response.Write(&quot;</p>&quot;)
%>
 
I have check the HTML code given back from the ASP. There are no problems with the HTML code. The image is coming back as muissing (i.e red suqare) instead it shows that it is an image but does not load it. As far as I can tell all quotes are in the right place and this should work. Am I crazy?

Thanx
Andrew
 
I'm sure you must have noticed by now that you typed scr= instead of src=.

Hope that helps!
 
Do you know what? I did not notice. Thats what you get for spending all day sat in front of a computer screen with phones ringing non-stop. The life of a computer techie. I would have thought that would have produced an error though. Oh well. Thanx for your help and I'll try not use you guys as my spell check again. LOL

Thanx again
Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top