关于flash头像如何集成进自己的java项目请教各位达人
有个项目需要一个头像上传的功能,懒的写了,就在网上找了个,这是JSP版的文件目录:
。这个插件直接在部署在tomcat下是能运行的:
。但是直接把那段flash拿下来放进自己的项目里貌似无法使用。这是页面上的flash:
<div id="altContent">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="650" HEIGHT="450" id="myMovieName">
<PARAM NAME=movie VALUE="
avatar.swf">
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<param name="flashvars" value="
imgUrl=./default.jpg&uploadUrl=./upfile.jsp&uploadSrc=false" />
<EMBED src="
avatar.swf" quality=high bgcolor=#FFFFFF WIDTH="650" HEIGHT="450" wmode="transparent" flashVars="
imgUrl=./default.jpg&uploadUrl=./upfile.jsp&uploadSrc=false"
NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" allowScriptAccess="always"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
</EMBED>
</OBJECT>
</div>
<div id="avatar_priview"></div>
这里是js:
<script type="text/javascript">
function uploadevent(status,picUrl,callbackdata){
//alert(picUrl); //后端存储图片
// alert(callbackdata);
status += '';
switch(status){
case '1':
var time = new Date().getTime();
var filename162 = picUrl+'_162.jpg';
var filename48 = picUrl+'_48.jpg';
var filename20 = picUrl+"_20.jpg";
document.getElementById('avatar_priview').innerHTML = "头像1 : <img src='"+filename162+"?" + time + "'/> <br/> 头像2: <img src='"+filename48+"?" + time + "'/><br/> 头像3: <img src='"+filename20+"?" + time + "'/>" ;
break;
case '-1':
window.location.reload();
break;
default:
window.location.reload();
}
}
</script>
还有一个jsp文件:
<%@page import="java.io.*,sun.misc.*,java.util.*"%>
<%
String path=application.getRealPath(request.getRequestURI());
String dir=new File(path).getParent();
String savePath = "./"; //保存图片路径 可以修改
String _savePath = dir + savePath;
long savePicName = new Date().getTime();
String file_src = _savePath + savePicName + "_src.jpg"; //保存原图
String filename162 = _savePath + savePicName + "_162.jpg"; //保存162
String filename48 = _savePath + savePicName + "_48.jpg"; //保存48
String filename20 = _savePath + savePicName + "_20.jpg"; //保存20
String pic=request.getParameter("pic");
String pic1=requ