终于要写一篇原创的文章了 ,以前都是考的,这次终于有自己原创了,哥现在的心情哪!不废话,start...
美图秀秀网页版是中国最流行的在线图片处理工具,在线使用,无需下载!独有的图片特效让你1分钟打造影楼级照片,效果最好的美容神器使你的照片更动人,三大拼图模式随心所欲玩转个性拼图。现在 新浪,qq,网易都在用 他的处理照片功能。可见,他发展的动力。
本文使用django1.4.3和python2.7.3+美图秀秀M3(拼图)来实现上传图片,并且处理图片功能。
1.上传html代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>图片拼接</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/static/meitu/xiuxiu.js"></script>
<script type="text/javascript">
window.οnlοad=function(){
xiuxiu.embedSWF("altContent",2,"540","400");
/*第1个参数是加载编辑器div容器,第2个参数是编辑器类型,第3个参数是div容器宽,第4个参数是div容器高*/
xiuxiu.setUploadURL("修改为您自己的上传接收图片程序
xiuxiu.setUploadType(2);
xiuxiu.setUploadDataFieldName("Filedata");
xiuxiu.onInit = function ()
{
xiuxiu.loadPhoto("http://localhost/static/upload/1.jpg");//这里为要初始加载的图片
// xiuxiu.loadPhoto("http://open.web.meitu.com/sources/images/1.jpg");
}
xiuxiu.setUploadType(2);//设置为2代表使用标准表单上传照片,具体可参考美图秀秀api官网http://open.web.meitu.com/wiki/
xiuxiu.setUploadDataFieldName("Filedata");//这是设置表单名(相当于:<input type="file" name="Filedata" />)
xiuxiu.onUploadResponse = function (data)//是否开启调试模式
{
alert("上传响应" + data);
}
}
</script>
<style type="text/css">
html, body { height:100%; overflow:hidden; }
body { margin:0; }
</style>
</head>
<body>
<form method="POST" enctype="multipart/form-data" action="/upload/">
<div id="altContent">
</div>
</form>
</body>
</html>