Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

img src="image.asp?id=1"

Options
  • 02-04-2004 4:37pm
    #1
    Closed Accounts Posts: 13


    Hi,

    After thinking i had come up with the solution of tracking newsletters see
    http://www.boards.ie/vbulletin/showthread.php?s=&threadid=149578

    i am foiled again.

    I have a database table of banners.

    The layout consists of
    BannerID
    SRC
    URL
    ALT
    PageImpressions
    PageClicks
    NewsletterImpressions
    NewsletterClicks

    where URL is the (root relative) source of the image on the server
    eg images/buttons/wc2006.gif

    I have a page:
    http://www.steintravel.ie/showbanner.asp
    that selects all the valid banners.
    Displays them, incrementing the PageImpressions count.
    This works fine. ANd when they are clicked on clickbanner.asp
    increments the PageClicks counter. lovely.

    If showbanner.asp is passed a bannerID as a querystring i am assuming that it is being called from a newsletter and so i want to just return the url of the image and not to display it. So within a newsletter i could use
    <img src="http://www.steintravel.ie/showbanner.asp?BannerID=3"&gt;

    i have tried this here
    http://www.steintravel.ie/test3.asp

    but from this page showbanner.asp isn't getting executed.
    it's not returning the image.

    This guy had the same problem but seemed to give up
    http://p2p.wrox.com/topic.asp?TOPIC_ID=7491

    I think it has something to do with the Img tag requiring binary type.
    Should i store the images as binary in the database. would this solve
    my problem. Is there any way to force it to execute?

    AAAAGGGHHHH my head hurts.

    Ill post the contents of showbanner.asp

    hoping one of you cleverclogs can help.
    much appreciated,

    mick


Comments

  • Closed Accounts Posts: 13 eldiablo


    '
    ' this page connects to the BannerSystem database and shows the current banner
    ' and increments the Impressions field

    BannerID = request.QueryString("BannerID")
    if BannerID = "" then
    '
    on the website so get active banners
    dim todaysDate
    todaysDate=FormatDateTime(now(),2)

    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open Application("ConnectionString")

    SQLQuery = "select * from BannerSystem where StartDate < '"&todaysDate&"' AND EndDate >= '"&todaysDate&"' order by Weight"
    Set BannerRS= Conn.Execute(SQLQuery)

    Do While Not BannerRS.EOF
    BannerID = BannerRS("ID")

    SQLQuery2 = "Update BannerSystem set PageImpressions = PageImpressions + 1 where ID = '"&BannerID&"'"
    Conn.Execute(SQLQuery2)
    'return the current banners, alts and links
    %>
    <a href="/clickbanner.asp?ID=<%=BannerRS("ID")%>" target="<%=BannerRS("Target")%>"><img src="<%=BannerRS("SRC")%>" alt="<%=BannerRS("ALT")%>" border="0"></a><br><br>
    <%
    BannerRS.MoveNext
    Loop
    Conn.Close

    else
    '
    showbanner is called from a newsletter
    'eg <img src="http://www.steintravel.ie/showbanner.asp?BannerID=2"&gt;

    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open Application("ConnectionString")

    SQLQuery = "select * from BannerSystem where ID = " & BannerID
    Set BannerRS= Conn.Execute(SQLQuery)

    Do While Not BannerRS.EOF
    BannerID = BannerRS("ID")

    SQLQuery2 = "Update BannerSystem set NewsImpressions = NewsImpressions + 1 where ID = " & BannerID
    Conn.Execute(SQLQuery2)

    response.Write(BannerRS("SRC"))

    BannerRS.MoveNext
    Loop
    Conn.Close

    end if
    '
    %>


  • Registered Users Posts: 4,889 ✭✭✭Third_Echelon


    just looking at your problem quickly... you seem to be pointing an img tag to an asp page when you need to point it to a graphic of some sort...

    you could try to include the page with the graphic on it in the other webpage... cant remember exactly how... i think it is <include =>

    im not 100% sure as i havent made a site in while (change of career in the IT industry) but check this out on one of the web dev sites...

    anyway hope this helps..


  • Closed Accounts Posts: 304 ✭✭Zaltais


    yep - you're returning a path to the image - you want to return the ACTUAL image.

    You can do this by either having the image in a binary column in your DB (which is quite resource intensive), or you can use the path to the image that you have to open the image using the FileSystemObject and return the contents of the file - after sending the necessary headers...

    I've never actually done this in ASP, so I'm too sure what problems you'll run into, but it's quite straightforward in Perl & PHP - once you bear in mind that you have to return an actual image to the browser...


  • Closed Accounts Posts: 13 eldiablo


    beautiful...

    thanks mate!

    works a dream!

    dim fs,f
    set fs=Server.CreateObject("Scripting.FileSystemObject")
    set f=fs.GetFile(Server.Execute(BannerRS("SRC")))
    set f=nothing
    set fs=nothing


    http://www.steintravel.ie/test3.asp

    wahooooo!!


Advertisement