View Full Version : Plz give some idea about picture
sheelaramu
03-23-2006, 06:22 AM
Hai,
I am new to asp. Plz give some idea to insert a picture by using ASP. I want to know the detailed coding about this.
Roelf
03-23-2006, 08:09 AM
Well, the result of your asp should be a valid image tag, like:
<img src="yourdirectory/yourimagefilename.jpg">
or for xhtml the minimum would be
<img src="yourdirectory/yourimagefilename.jpg" alt="your alt text" />
Now create Response.write statements which produce this, like
Response.Write "<img src=""yourdirectory/yourimagefilename.jpg"" alt=""your alt text"" />"
(double the quotes or otherwise they wont be in the output)
And you can also use variables to product the content of the src and alt attributes
Response.Write "<img src="""
Response.Write thevarthatholdsyourfilename
Response.Write """ alt="""
Response.Write thevarthatholdsyouralttext
Response.Write """ />"
Or combine this to a single line
Response.Write "<img src=""" & thevarthatholdsyourfilename & """ alt=""" & thevarthatholdsyouralttext & """ />"
degsy
03-23-2006, 03:53 PM
You need to give more info. Where is your image filename/url coming from?
Is it a from a database recordset or a filesystem object?
Another alternative is to break in and out of HTML
<%
image_name = "myimage.jpg"
image_alt = "My Image"
%>
<img src="<%=image_name%>" alt="<%=image_alt%>" />
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.