simpleDemo.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>Simple demo</title>
  6. <script type="text/javascript" src="scripts/swfobject.js"></script>
  7. <script type="text/javascript" src="scripts/fullAvatarEditor.js"></script>
  8. </head>
  9. <body class="gray-bg">
  10. <div style="width:630px;margin: 0 auto;">
  11. <h1 style="text-align:center">富头像上传编辑器演示</h1>
  12. <div>
  13. <p id="swfContainer">
  14. 本组件需要安装Flash Player后才可使用,请从<a href="http://www.adobe.com/go/getflashplayer">这里</a>下载安装。
  15. </p>
  16. </div>
  17. <p style="text-align:center"><button type="button" id="upload">自定义上传按钮</button></p>
  18. <p style="text-align:center">提示:本演示使用的上传接口类型为ASP,如要测试上传,请在服务器环境中演示,更多演示请看<a href="http://www.fullavatareditor.com/demo.html">http://www.fullavatareditor.com/demo.html</a></p>
  19. </div>
  20. <script type="text/javascript">
  21. swfobject.addDomLoadEvent(function () {
  22. var swf = new fullAvatarEditor("swfContainer", {
  23. id: 'swf',
  24. upload_url: 'asp/Upload.asp',
  25. src_upload:2
  26. }, function (msg) {
  27. switch(msg.code)
  28. {
  29. case 1 : alert("页面成功加载了组件!");break;
  30. case 2 : alert("已成功加载默认指定的图片到编辑面板。");break;
  31. case 3 :
  32. if(msg.type == 0)
  33. {
  34. alert("摄像头已准备就绪且用户已允许使用。");
  35. }
  36. else if(msg.type == 1)
  37. {
  38. alert("摄像头已准备就绪但用户未允许使用!");
  39. }
  40. else
  41. {
  42. alert("摄像头被占用!");
  43. }
  44. break;
  45. case 5 :
  46. if(msg.type == 0)
  47. {
  48. if(msg.content.sourceUrl)
  49. {
  50. alert("原图已成功保存至服务器,url为:\n" + msg.content.sourceUrl);
  51. }
  52. alert("头像已成功保存至服务器,url为:\n" + msg.content.avatarUrls.join("\n"));
  53. }
  54. break;
  55. }
  56. }
  57. );
  58. document.getElementById("upload").onclick=function(){
  59. swf.call("upload");
  60. };
  61. });
  62. var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
  63. document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F5f036dd99455cb8adc9de73e2f052f72' type='text/javascript'%3E%3C/script%3E"));
  64. </script>
  65. </body>
  66. </html>