doppelme logo

Example Integration Code

Below are 4 example ASP files that illustrate how to integrate DoppelMe avatars within your website using the SOAP API. These are given for example only and no warranty is provided. These example are given in ASP - but the same prinicples can be applied to code in other languages/frameworks.

doppelme.asp | profile_avatar.asp | profile_avatar_create.asp | profile_avatar_updated.asp

A simple page showing the completed avatar

A landing page once a user has updated their avatar. Not obligatory - you could just redirect users back to their profile page for example.
<!-- #include virtual="/include/doppelme.asp"-->
<html>
<head>
</head>
<body>
<%
    
    USER_ID = Session("UserID")
    
    '//get avatar key from your database. (sql below is just example code)
    '//alternatively you could get this from your session object if you keep this there.
    sSQL = "select DoppelMeKey from [YourUserTable] where UserID=" & USER_ID
    oRS.Open sSQL, oDB
        sDOPPELME_KEY = oRS("DoppelMeKey")
    oRS.Close
                    
    '//build avatar details from user details
    sAVATAR = "<img src=""http://www.doppelme.com/60/TRANSPARENT/" & Server.URLEncode(sDOPPELME_KEY) & "/avatar.png"" alt=""DoppelMe Avatar">"
    
%>

    <table style="width: 400px; margin: 0 auto; text-align:center;"
    <tr><td><%=sAVATAR%></td></tr>
    <tr><td>Your avatar has been updated!</td></tr>
    </table>
    
</body>
</html>