美图秀秀web开发文档
Xiuxiu 组件
import React, { Component } from 'react';
class XiuXiu extends Component {
componentDidMount() {
const {closeModal, imageUrl, uploadUrl, formData} = this.props;
/* 第1个参数是加载编辑器div容器,第2个参数是编辑器类型,第3个参数是div容器宽,第4个参数是div容器高*/
xiuxiu.embedSWF('altContent', 1, '700px', '520px');
// 修改为您自己的图片上传接口
xiuxiu.setUploadURL(uploadUrl);
xiuxiu.setUploadType(2);
xiuxiu.setUploadDataFieldName('file');
xiuxiu.setUploadArgs(formData);
xiuxiu.onInit = function () {
xiuxiu.loadPhoto(imageUrl);
};
xiuxiu.onUploadResponse = function (data) {
closeModal(true);
};
xiuxiu.onBatchUploadComplete = function () {
closeModal(true);
};
xiuxiu.onClose = function(id) {
closeModal(false);
};
xiuxiu.onUpload = function(id) {
closeModal(true);
};
}
render() {
return (
<div id='altContent'>
</div>
);
}
}
export default XiuXiu;
XiuxiuComponent
class XiuXiuModal extends Component {
state = {
visible: false,
}
showModal = () => {
this.setState({visible: true});
}
closeModal = (isEdit) => {
const {imageUrl} = this.props;
this.props.onClose(imageUrl, isEdit);
this.setState({visible: false});
}
render() {
const {children, policyImage, imagePath} = this.props;
const formData = {
signature: policyImage.signature,
OSSAccessKeyId: policyImage.accessid,
policy: policyImage.policy,
key: imagePath,
success_action_status: '200',
};
return (
<a onClick={this.showModal}>
{children}
{this.state.visible && <Modal wrapClassName='xiuxiu-wrapper' closable={false} width='700px' footer={null} title={null} visible >
<XiuXiu uploadUrl={policyImage.host} formData={formData} closeModal={this.closeModal} {...this.props} />
</Modal>}
</a>
);
}
}
最终引入
import XiuXiu from 'components/XiuXiu';
class ItemBox extends Component {
componentDidMount () {
const {folderFormatType, folderId, actions: {policyActions: {getImagePolicy}, ownActions: {loadMaterial}}} = this.props;
loadMaterial(folderId, undefined, true, folderFormatType);
getImagePolicy();
}
cancelEditImage = (imageUrl, isEdit) => {
const {actions: {ownActions: {editMaterial}}, materials} = this.props;
const item = find(materials, {coverImage: imageUrl});
if(isEdit) {
editMaterial({
id: item.id,
version: item.version + 0.1,
});
}
}
render () {
const {actions: {ownActions: {addMaterial, loadMaterial}},
page, policyImage, materials, folderId, folder, profile} = this.props;
return (
<XiuXiuModal onClose={this.cancelEditImage} imagePath={item.path} policyImage={policyImage} imageUrl={item.url}>
编辑图片
</XiuXiuModal>
);
}
}
注意:
1、引入美图秀秀必须加载上传图片接口
2、设置crossdomain.xml
下载crossdomain.xml文件,把解压出来的crossdomain.xml文件放在您保存图片或图片来源的服务器根目录下,
比如: http://example.com.cn,那么crossdomain.xml的路径为:http://example.com.cn/crossdomain.xml。
需要注意的是crossdomain.xml必须部署于站点根目录下才有效, crossdomain.xml的目的是授权来自美图域下的flash向您的站点上传图片或者从您的站点加载图片。
【备注】由于本地测试会被flash安全沙箱拦住,请自行搭建web服务器,在web 环境中测试。
美图秀秀web开发文档的更多相关文章
- 美图秀秀 web开发图片编辑器
美图秀秀web开发平台 http://open.web.meitu.com/wiki/ 1.环境配置 1.1.设置crossdomain.xml 下载crossdomain.xml文件,把解压出来的c ...
- web开发文档整理
django 1.11版中文文档 django 1.11版英文文档 Redis命令参考文档 Axios中文文档 Axios英文官方文档 Django REST Framework官方文档 Vue.js ...
- Web图片编辑控件开发文档-Xproer.ImageEditor
版权所有 2009-2014 荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com 产品首页:http://www.ncmem.com/webplug/image-e ...
- thinkphp + 美图秀秀api 实现图片裁切上传,带数据库
思路: 1.数据库 创建test2 创建表img,字段id,url,addtime 2.前台页: 1>我用的是bootstrap 引入必要的js,css 2>引入美图秀秀的js 3.后台: ...
- 美图秀秀api实现图片的裁剪及美化
美图秀秀不仅有PC版.手机版等客户端的软件,还有Web开方接口,可以在web页面上调用美图秀秀的api接口,实现图片的编辑.像淘宝.网易.qq空间.新浪微博等大厂都使用过该接口. 官网地址:http: ...
- 简易的美图秀秀利用别人的so库
在实际开发中,有时候时间短,任务量大,可以查看类似的apk,将行apk反编译,通过看源码分析,用里面的JNI代码! 本案例中用了美图秀秀的JNI.java和jni.so链接库 项目中调用别人写的c代码 ...
- C#微信开发文档
C#微信开发文档 开发前准备 微信公众平台链接: https://mp.weixin.qq.com/cgi-bin/home?t=home/index&lang=zh_CN 开发初期我们使用测 ...
- QM项目开发文档整理
QM项目开发文档整理 前言 在W公司工作4个多月,庆幸接触到的全是"硬"项目,真枪实干,技术.经验.能力都得到了很大提升. QM项目 此项目WEB前端学到的东西很多,对PHP项目的 ...
- 美图秀秀DBA谈MySQL运维及优化
美图秀秀DBA谈MySQL运维及优化 https://mp.weixin.qq.com/s?__biz=MzI4NTA1MDEwNg==&mid=401797597&idx=2& ...
随机推荐
- 【NOIP2017提高组模拟7.3】B
树上路径统计,点分治解决. 统计一段区间,naive地用了set解决,这样的复杂度是O(nlog^2n)的 考场代码出了个问题,统计答案时找到了之前的最优答案,但是没有加上新的一段,导致60分 #in ...
- Golang 谷歌搜索api 实现搜索引擎(前端 bootstrap + jquery)
Golang 谷歌搜索api 实现搜索引擎(前端 bootstrap + jquery) 体验 冒号搜索 1. 获取谷歌搜索api 谷歌搜索api教程 2. 后台调用 程序入口 main.go // ...
- VMware安装Ubuntu配置NAT模式下静态IP,解决访问外网问题
安装好VMware后,打开网络连接可以看到有VMware Network Adapter VMnet1和VMware Network Adapter VMnet8两个网络适配器,VMnet1是针对桥接 ...
- 控制nginx并发链接数量和客户端请求nginx的速率
一.控制nginx并发链接数 ngx_http_limit_conn_module这个模块用于限制每个定义的key值的链接数,特别是单IP的链接数. 不是所有的链接数都会被计数,一个符合计数要求的连接 ...
- Go IO && bufio
IO IO包 是对数据流的操作.从哪里来, 怎么处理,再到哪里去. 图片来源 https://medium.com/learning-the-go-programming-language/strea ...
- python爬虫基础09-selenium大全3/8-Remote Webdriver
Selenium笔记(3)Remote Webdriver 本文集链接:https://www.jianshu.com/nb/25338984 简介 selenium.webdriver.remote ...
- HDU 5025 Saving Tang Monk(状态转移, 广搜)
#include<bits/stdc++.h> using namespace std; ; ; char G[maxN][maxN], snake[maxN][maxN]; ]; int ...
- MySQL中的DDL(Data Definition Language,数据定义语言)
create(创建表) 标准的建表语句: create table [模式名.]表名 ( #可以有多个列定义 columnName1 dataType [default expr(这是默认值)], . ...
- Python 爬取图书图片和地址
#-*- coding:utf-8 -*- import xlwt import urllib import re def getHtml(url): page = urllib.urlopen(ur ...
- 从几率到logisitic函数
odds 几率,又称事件的优势比.几率和概率的关系如下: o=p1−pp=o1+o Logistic 回归模型的因变量只有 1/0 两种取值.假设在 p 个独立自变量 x1,x2,…,xp 作用下,记 ...