Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Plz give some idea about picture

    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.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    Well, the result of your asp should be a valid image tag, like:
    Code:
    <img src="yourdirectory/yourimagefilename.jpg">
    or for xhtml the minimum would be
    Code:
    <img src="yourdirectory/yourimagefilename.jpg" alt="your alt text" />
    Now create Response.write statements which produce this, like

    Code:
    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
    Code:
    Response.Write "<img src="""
    Response.Write thevarthatholdsyourfilename
    Response.Write """ alt="""
    Response.Write thevarthatholdsyouralttext
    Response.Write """ />"
    Or combine this to a single line

    Code:
    Response.Write "<img src=""" & thevarthatholdsyourfilename & """ alt=""" & thevarthatholdsyouralttext & """ />"
    I am the luckiest man in the world

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Code:
    <%
    image_name = "myimage.jpg"
    image_alt = "My Image"
    %>
    <img src="<%=image_name%>" alt="<%=image_alt%>" />


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •