本例以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调用)免费插件的更多相关文章

  1. php 获取远程图片保存到本地

    php 获取远程图片保存到本地 使用两个函数 1.获取远程文件 2.把图片保存到本地 /** * 获取远程图片并把它保存到本地 * $url 是远程图片的完整URL地址,不能为空. */ functi ...

  2. iOS 将图片保存到本地

    //将图片保存到本地 + (void)SaveImageToLocal:(UIImage*)image Keys:(NSString*)key {     NSUserDefaults* prefer ...

  3. iOS-iOS调用相机调用相册【将图片保存到本地相册】

    设置头部代理 <UINavigationControllerDelegate, UIImagePickerControllerDelegate> 1.调用相机 检测前置摄像头是否可用 - ...

  4. Android View转为图片保存为本地文件,异步监听回调操作结果;

    把手机上的一个View或ViewGroup转为Bitmap,再把Bitmap保存为.png格式的图片: 由于View转Bitmap.和Bitmap转图片都是耗时操作,(生成一个1M的图片大约500ms ...

  5. js截图及绕过服务器图片保存至本地(html2canvas)

    今天要分享的是用html2canvas根据自己的需求生成截图,并且修复html2canvas截图模糊,以及绕过服务器图片保存至本地. 只需要短短的几行代码,就能根据所需的dom截图,是不是很方便,但是 ...

  6. React Native之图片保存到本地相册(ios android)

    React Native之图片保存到本地相册(ios android) 一,需求分析 1,react native保存网络图片到相册,iOS端可以用RN自带的CameraRoll完美解决,但是andr ...

  7. FFmpeg解码视频帧为jpg图片保存到本地

    FFmpeg解码视频帧为jpg图片保存到本地 - CSDN博客 https://blog.csdn.net/qq_28284547/article/details/78151635

  8. java将base64解析图片保存到本地。

    将base64解析图片保存到本地的两个方法 /** * base64转图片 * @param base64str base64码 * @param savePath 图片路径 * @return */ ...

  9. 2018-5-22-SublimeText-粘贴图片保存到本地

    title author date CreateTime categories SublimeText 粘贴图片保存到本地 lindexi 2018-05-22 15:15:26 +0800 2018 ...

随机推荐

  1. Linux上从Java程序中调用C函数

    原则上来说,"100%纯Java"的解决方法是最好的,但有些情况下必须使用本地方法.特别是在以下三种情况: 需要访问Java平台无法访问的系统特性和设备: 通过基准测试,发现Jav ...

  2. win7下matlab2016a配置libsvm

    1.下载libsvm https://www.csie.ntu.edu.tw/~cjlin/libsvm/ 2.解压到matlab2016a的安装目录的toolbox下 例如我的D:\Program ...

  3. linux的whoami, who指令

    who 这个命令重点在用来查看当前有那些用户登录到了本台机器上 whoami 显示的是有效用户用户名 ,是当前操作用户的用户名 who am i == who -m 显示的是实际用户的用户名,即用户登 ...

  4. TWebBrowser 调用最新版的Ie Internet Feature Controls (B..C)

    Internet Feature Controls (B..C)   Updated: July 2012 This article describes feature controls with n ...

  5. 编码转换的处理 DreamWeaver SC6 打开会出现javacsript出现问题的处理

      编码转换的处理: 打开DW后,修改里面有个"页面属性": 点击页面属性,会弹出一个窗口,点击"标题/编码",在"编码"里面选择你要转换的 ...

  6. Zabbix3.x安装图解教程

    准备知识: Zabbix3.x比较之前的2.0界面有了很大的变化,但是安装部署过程与2.x基本完全一样. 1.Zabbix2.x安装图解教程 http://www.osyunwei.com/archi ...

  7. OpenModelica仿真

    复杂产品通常涉及机械.控制.电子.液压.气动和软件等多学科领域,其设计过程需要进行仿真,以满足对成本.质量.性能等的要求.目前各个学科和领域都已经有了比较成熟的仿真软件,但大部分仿真软件仅适用于本学科 ...

  8. R12供应商地点层付款方法SQL

    --R12供应商地点层付款方法SQL:SELECT ipmv.payment_method_name     , ipmv.payment_method_code     , 'N' primary_ ...

  9. Linux帮助命令

    帮助命令:man man 命令 获取命令的帮助 如下: [root@localhost ~]# man ls LS(1) User Commands LS(1) NAME ls - list dire ...

  10. JFinal - Log 日志

    今天偶然发现 JFinal 的 Log 简单小巧.上代码. JFinal 在初始化的时候有初始化 Log. class Config { // ... static void configJFinal ...