Can someone help me display a user photo in ASP?

Discussion in 'C#' started by JMancuso, Jan 29, 2008.

  1. #1
    I have a social networking site and I already display the online users username. I want to add the users default photo next to it. Can someone tell me how I would do this? I am displaying the existing xsl code first and under it I am displaying some ASP code that displays a user photo in another area of the site. I am sure I would combine the two somehow.

    If anyone could help me out I would really appreciate it.



    <xsl:for-each select="users/user/userID">


    <tr><td><b><xsl:value-of select='position()'/>.</b></td>


    <td bgcolor='black'><a><xsl:attribute name="class">sideLink</xsl:attribute>
    <xsl:attribute name="href">u_profile.asp?userID=<xsl:value-of select="."/>
    </xsl:attribute>
    <font>
    <xsl:attribute name="color">
    <xsl:if test="../color!=000000"><xsl:value-of select="../color"/></xsl:if>
    <xsl:if test="../color=000000">666666</xsl:if>
    <xsl:if test="not(../color)">ffffff</xsl:if>
    </xsl:attribute>
    <xsl:value-of select="../username"/>
    </font></a>
    </td></tr>

    --------------------------------------------------------



    Response.Write "<tr>" &vbcr
    Response.Write "<td class='vHeader' align='center'><b>" & rs("ID") & ".</b></td>" &vbcr
    Response.Write "<td class='vBody' valign='top'>"
    Response.Write "<b><a href='u_profile.asp?userID=" & rs("userID") & "'>" & rs("username") & "</a></b><br>" &vbcr
    Response.Write "<a href='mailto:" & rs("email") & "'>" & rs("email") & "</a>"
    Response.Write "</td>" &vbcr
    Response.Write "<td class='vBody' valign='top' colspan='4'>"
    If isNull(rs("photoID")) Then
    Response.Write "&nbsp;"
    Else
    Response.Write "<a href='" & display_img_link(rs("photoID"),0) & "'><img src='user_photo/" & rs("photoID") & "s.jpg'></a><br>"
    End If
    Response.Write "</td>" &vbcr
    Response.Write "</tr>" &vbcr


    If anyone could help me with this I would be willing to trade some free ad space. I get 5,000 uniques a day.
     
    JMancuso, Jan 29, 2008 IP
  2. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Not too familiar with XSL.. however i do think the ASP code would work. If you can send me the page, i could go through it and send it back fixed.
     
    Talker, Jan 30, 2008 IP
  3. vbrocks

    vbrocks Active Member

    Messages:
    90
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    98
    #3
    Hi,

    if you store photos in the file system - that's easy - just put file link.
    It gets a little more complex if you store images in the database.
    What i would do - i would use the http handlers for asp.net.

    A good explanation for http handlers for .net 2.0 is here - http://www.developer.com/net/asp/article.php/3565541

    Regards.
     
    vbrocks, Feb 9, 2008 IP