编辑美化图片,保存至本地,Adobe出品(支持IOS,android,web调用)免费插件
本例以web调用做为例子,本插件支持主流浏览器,IE要9以上,移动设备,触屏设备也支持,能自适应屏幕大小。
使用效果:

工具还是很丰富的,编辑完成之后,可以保存图片至本地目录。
使用说明:
1,需要在线注册账号,申请apikey,地址:https://creativesdk.adobe.com/docs/web,这个apikey在代码调用时需要。这里也有详细的api文档,其他功能请参考文档说明,不过文档是英文的。
2,要编辑的图片必须有固定的地址,可以被网络访问到。
示例源代码,以web调用为例:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>汽车图片编辑</title>
<%-- <script src="js/CarPhotoEdit.js"></script>--%>
<script src="../Scripts/jquery-1.7.1.js"></script>
<script src="https://dme0ih8comzn4.cloudfront.net/js/feather.js"></script>
<script type='text/javascript'>
//在线编辑图片功能,第三方插件,完全免费
var featherEditor = new Aviary.Feather({
apiKey: 'wanghuifang2008@yeah.net',//apikey可以免费申请,https://creativesdk.adobe.com/docs/web/#/index.html
apiVersion: 3,
theme: 'dark', // Check out our new 'light' and 'dark' themes!
tools: 'blemish',//这里设置为all,可以显示所有的工具
initTool: 'blemish',//默认展开的工具
language: 'zh_HANS',//简体中文
appendTo: '',
onSave: function (imageID, newURL) {
//alert(newURL);
$.ajax({
url: "ashx/CarInfo.ashx?type=DownloadCarPhoto&imgUrl=" + newURL + "&rand=" + Math.random(),
success: function (url) {
alert('保存成功');
var img = document.getElementById(imageID);
img.src = url;
},
error: function () {
alert('error')
}
}); },
onError: function (errorObj) {
alert(errorObj.message);
}
});
function launchEditor(id, src) {
featherEditor.launch({
image: id,
url: src
});
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id='injection_site'></div>
<%--http://images.aviary.com/imagesv5/feather_default.jpg--%>
<%--http://car0.autoimg.cn/car/upload/2015/1/8/v_20150108092921264345010.jpg--%>
<img id='image1' src='http://images.aviary.com/imagesv5/feather_default.jpg'/> <!-- Add an edit button, passing the HTML id of the image and the public URL of the image -->
<p><input type='image' src='' value='Edit photo' onclick="return launchEditor('image1', 'http://images.aviary.com/imagesv5/feather_default.jpg');" /></p> </form>
</body>
</html>
CarInfo.ashx功能是下载处理好的图片到本地,代码参考(来自网络):
/// <summary>
/// 下载远程图片保存到本地
/// </summary>
/// <param name="savedir">本地保存路径</param>
/// <param name="imgpath">远程图片文件</param>
/// <returns></returns>
public string downRemoteImg(string savedir, string imgpath)
{
if (string.IsNullOrEmpty(imgpath))
return string.Empty;
else
{
string imgName = string.Empty;
string imgExt = string.Empty;
string saveFilePath = string.Empty;
imgName = imgpath.Substring(imgpath.LastIndexOf("/"), imgpath.Length - imgpath.LastIndexOf("/"));
imgExt = imgpath.Substring(imgpath.LastIndexOf("."), imgpath.Length - imgpath.LastIndexOf(".")); saveFilePath = System.Web.HttpContext.Current.Server.MapPath(savedir);
if (!Directory.Exists(saveFilePath))
Directory.CreateDirectory(saveFilePath); try
{
WebRequest wreq = WebRequest.Create(imgpath);
wreq.Timeout = ;
HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse();
Stream s = wresp.GetResponseStream();
System.Drawing.Image img;
img = System.Drawing.Image.FromStream(s);
switch (imgExt.ToLower())
{
case ".gif":
img.Save(saveFilePath + imgName, ImageFormat.Gif);
break;
case ".jpg":
case ".jpeg":
img.Save(saveFilePath + imgName, ImageFormat.Jpeg);
break;
case ".png":
img.Save(saveFilePath + imgName, ImageFormat.Png);
break;
case ".icon":
img.Save(saveFilePath + imgName, ImageFormat.Icon);
break;
case ".bmp":
img.Save(saveFilePath + imgName, ImageFormat.Bmp);
break;
} img.Dispose();
s.Dispose(); return savedir + imgName;
}
catch
{
return imgpath;
}
}
}
编辑美化图片,保存至本地,Adobe出品(支持IOS,android,web调用)免费插件的更多相关文章
- php 获取远程图片保存到本地
php 获取远程图片保存到本地 使用两个函数 1.获取远程文件 2.把图片保存到本地 /** * 获取远程图片并把它保存到本地 * $url 是远程图片的完整URL地址,不能为空. */ functi ...
- iOS 将图片保存到本地
//将图片保存到本地 + (void)SaveImageToLocal:(UIImage*)image Keys:(NSString*)key { NSUserDefaults* prefer ...
- iOS-iOS调用相机调用相册【将图片保存到本地相册】
设置头部代理 <UINavigationControllerDelegate, UIImagePickerControllerDelegate> 1.调用相机 检测前置摄像头是否可用 - ...
- Android View转为图片保存为本地文件,异步监听回调操作结果;
把手机上的一个View或ViewGroup转为Bitmap,再把Bitmap保存为.png格式的图片: 由于View转Bitmap.和Bitmap转图片都是耗时操作,(生成一个1M的图片大约500ms ...
- js截图及绕过服务器图片保存至本地(html2canvas)
今天要分享的是用html2canvas根据自己的需求生成截图,并且修复html2canvas截图模糊,以及绕过服务器图片保存至本地. 只需要短短的几行代码,就能根据所需的dom截图,是不是很方便,但是 ...
- React Native之图片保存到本地相册(ios android)
React Native之图片保存到本地相册(ios android) 一,需求分析 1,react native保存网络图片到相册,iOS端可以用RN自带的CameraRoll完美解决,但是andr ...
- FFmpeg解码视频帧为jpg图片保存到本地
FFmpeg解码视频帧为jpg图片保存到本地 - CSDN博客 https://blog.csdn.net/qq_28284547/article/details/78151635
- java将base64解析图片保存到本地。
将base64解析图片保存到本地的两个方法 /** * base64转图片 * @param base64str base64码 * @param savePath 图片路径 * @return */ ...
- 2018-5-22-SublimeText-粘贴图片保存到本地
title author date CreateTime categories SublimeText 粘贴图片保存到本地 lindexi 2018-05-22 15:15:26 +0800 2018 ...
随机推荐
- OpenGL FAQ
转自:http://www.cnblogs.com/indif/archive/2011/04/22/2024659.html 1.什么是OpenGL?OpenGL即开放图形库(Open Graphi ...
- 20161013001 DataGridView 数据转 DataTable
DataTable dt2 = GetDgvToTable(Form_CY_ProjectRequirements_D); MessageBox.Show( dt2.Rows.Count.To ...
- JAVA继承时构造函数的问题
今天看到java继承部分时,关于构造函数是否继承以及如何使用时遇到了点问题,后来查找相关资料解决了. 下面是我个人的总结: 先创建一个父类,里面有两个构造函数: public class Jisuan ...
- (转)sqlplus中文显示乱码的问题
sqlplus中文显示乱码的问题 2010-07-19 11:33:26 分类: LINUX 在windows下sqlplus完全正常,可是到linux下,sqlplus中文显示就出问题了,总是显示“ ...
- Java开发中经典的小实例-(打印输入重复的值)
import java.util.ArrayList;import java.util.Scanner;public class Test8 { public static void main( ...
- Linux就该这么学
第三章:Vim编辑器与Shell脚本 Vim文本编辑器 在Linux系统中配置应用服务,实际上就是在修改它的配置文件. 在热门的Linux操作系统中都会默认安装一款超好用的文本编辑器--"v ...
- php 资源
ThinkPHP http://www.thinkphp.cn/ 小案例 http://www.helloweba.com/php.html Github上的PHP资源汇总大全 http://www. ...
- 隐藏原生html5 video controls
隐藏原生html5 video controls 凤凰视频焦点项目mobile html5播放器测试时bug,由于没有用原生的controls而是自己写的custom controls,虽然设置了co ...
- 上传文件fileupload
文件上传: 需要使用控件-fileupload 1.如何判断是否选中文件? FileUpload.FileName - 选中文件的文件名,如果长度不大于0,那么说明没选中任何文件 js - f.va ...
- 关于HTML5你必须知道的28个新特性,新技巧以及新技术
1. 新的Doctype 尽管使用<!DOCTYPE html>,即使浏览器不懂这句话也会按照标准模式去渲染 2. Figure元素 用<figure>和<figcapt ...