首页 > 编程 > JavaScript > 正文

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

2019-11-20 12:56:21
字体:
来源:转载
供稿:网友

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的简单使用示例了,希望对大家能够有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表