Discuz! Upload Avatar function (Silverlight) of NT)

Source: Internet
Author: User

The functions of Silverlight and Flash are no different, but because it is developed on the. NET platform, you can modify it as needed. The source code can be downloaded at webcam.codeplex.com, but some machines with Windows 2003 installed may encounter errors when saving images.


Server side of the pageCodeLike the Flash version, no code is pasted, but the client must add

Code

  <  Div  ID  = "Avatarsilverlight"  Style  = "Clear: Both; display: none; width: 520px; Height: 300px ;"  > 
< Script Type = "Text/JavaScript" SRC = "<% = Localhost %>/Silverlight/Avatar/Silverlight. js" Reload = "1" > </ Script >
< Div ID = "Silverlightcontrolhost" Style = "Width: 520px; Height: 300px ;" >
< Object ID = "Avatarupload" Data = "Data: Application/x-silverlight-2 ," Type = "Application/x-silverlight-2"
Width = "520px" Height = "300px" >
< Param Name = "Source" Value = "<% = Localhost %>/Silverlight/Avatar/clientbin/webcam. xap" />
< Param Name = "Onerror" Value = "Onsilverlighterror" />
< Param Name = "Background" Value = "White" />
< Param Name = "Minruntimeversion" Value = "4.0.50401.0" />
< Param Name = "OnLoad" Value = "OnLoad" />
< Param Name = "Autoupgrade" Value = "True" />
< Param Name = "Initparams" Value = "Authtoken = adagiwinbm8 =, savepath =/images/upload/avatars/{0}/{0 }_" />
< A Href = "Http://go.microsoft.com/fwlink? Linkid = 149156 & V = 4.0.50401.0" Style = "Text-Decoration: none"
Target = "_ Blank" >
< IMG SRC = "<% = Localhost %>/Silverlight/Avatar/avatar.jpg" ALT = "Install the Microsoft Silverlight control and immediately use the silver Avatar"
Style = "Border-style: none" />
</ A >
</ Object >
</ Div >
< Script Type = "Text/JavaScript" >
Function Onload (plugin, usercontext, Sender ){
$ ( " Avatarupload " ). Content. javascriptobject. closeavatar = Updateavatar; // Register JS methods for Silverlight to call
}
</ Script >
</ Div >

<Param name = "Source" value = "<% = localhost %>/Silverlight/Avatar/clientbin/webcam. xap"/> is the path of the Silverlight file. If the server does not support xap files, you can change the file suffix to HTML.
<Param name = "initparams" value = "authtoken = adagiwinbm8 =, savepath =/images/upload/avatars/{0}/{0} _ "/> is used to set parameters for Silverlight. savepath is the path for saving images, the User ID of {0. The path of the servicepath WebService file remains unchanged.

 

Code download

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.