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

编程学习 2021-07-04 21:47www.dzhlxh.cn编程入门
这篇文章主要介绍了Flash图片上传组件 swfupload使用方法及示例,swfupload的使用范围十分的广泛,功能也很强大,今天我们就先来简单的通过范例来学习下。

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

Copyright © 2016-2025 www.dzhlxh.cn 金源码 版权所有 Power by

网站模板下载|网络推广|微博营销|seo优化|视频营销|网络营销|微信营销|网站建设|织梦模板|小程序模板