首页  >  文章  >  web前端  >  Flash图片上传组件 swfupload使用指南_javascript技巧

Flash图片上传组件 swfupload使用指南_javascript技巧

WBOY
WBOY原创
2016-05-16 16:09:331026浏览

swfupload上传编辑器是一款支持本地上传、预览、视频拍照和网络加载的flash头像编辑上传插件,可缩放、裁剪、旋转、定位和调色等,同时支持asp、asp.net、jsp、php等多语种

复制代码 代码如下:

swfobject.addDomLoadEvent(function () {
               var swf = new fullAvatarEditor("swfContainer", {
                       id: 'swf',
                       upload_url: 'asp/Upload.asp',
                       src_upload:2
                   }, function (msg) {
                       switch(msg.code)
                       {
                           case 1 : alert("页面成功加载了组件!");break;
                           case 2 : alert("已成功加载默认指定的图片到编辑面板。");break;
                           case 3 :
                               if(msg.type == 0)
                               {
                                   alert("摄像头已准备就绪且用户已允许使用。");
                               }
                               else if(msg.type == 1)
                               {
                                   alert("摄像头已准备就绪但用户未允许使用!");
                               }
                               else
                               {
                                   alert("摄像头被占用!");
                               }
                           break;
                           case 5 :
                               if(msg.type == 0)
                               {
                                   if(msg.content.sourceUrl)
                                   {
                                       alert("原图已成功保存至服务器,url为:n"  msg.content.sourceUrl);
                                   }
                                   alert("头像已成功保存至服务器,url为:n" msg.content.avatarUrls.join("n"));
                               }
                           break;
                       }
                   }
               );
               document.getElementById("upload").onclick=function(){
                   swf.call("upload");
               };
           });

演示图:

以上就是本文关于swfupload的简单使用示例了,希望对大家能够有所帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn