Adobe Creative sdk:保存后如何获取Base64图像数据
如何在保存图像时获取base64格式Adobe Creative sdk:保存后如何获取Base64图像数据,adobe,adobecreativesdk,Adobe,Adobecreativesdk,如何在保存图像时获取base64格式 onSave: function(imageID, newURL) { originalImage.src = newURL; featherEditor.close(); } 下面是我在Angular 1/Cordova(Phonegap)应用程序中使用的一些代码,显然你可能想去掉这些承诺,而且它也不会以任何方式进行重构(仅两个复制/粘贴作业),而是进行处理。您还需要安装cordova文件插件 function _launchEditor(i
onSave: function(imageID, newURL) {
originalImage.src = newURL;
featherEditor.close();
}
下面是我在Angular 1/Cordova(Phonegap)应用程序中使用的一些代码,显然你可能想去掉这些承诺,而且它也不会以任何方式进行重构(仅两个复制/粘贴作业),而是进行处理。您还需要安装cordova文件插件
function _launchEditor(imageUrl, options) {
/* 2.a) Prep work for calling `.edit()` */
var deferred = $q.defer();
function success(newUrl) {
/**
* This function will handle the conversion from a file to base64 format
*
* @path string
* @callback function receives as first parameter the content of the image
*/
function getFileContentAsBase64(path, callback) {
window.resolveLocalFileSystemURL(path, gotFile, error);
function gotFile(fileEntry) {
fileEntry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function (e) {
var content = this.result;
callback(content);
};
// The most important point, use the readAsDatURL Method from the file plugin
reader.readAsDataURL(file);
});
}
}
getFileContentAsBase64(newUrl, function (base64Image) {
//window.open(base64Image);
// Then you'll be able to handle the myimage.png file as base64
deferred.resolve({
data: base64Image,
url: newUrl
})
});
}
function error(error) {
deferred.reject(error);
}
if (!options) {
options = {
outputType: CSDKImageEditor.OutputType.JPEG,
tools: [
CSDKImageEditor.ToolType.CROP,
CSDKImageEditor.ToolType.ORIENTATION,
CSDKImageEditor.ToolType.TEXT,
CSDKImageEditor.ToolType.DRAW
],
quality: 50
}
}
/* 2.b) Launch the Image Editor */
CSDKImageEditor.edit(success, error, imageUrl, options);
return deferred.promise;
}
那就打电话给我
_launchEditor(<ImageUrl>)
.then(function(data){
//data.url = creativesdk saved image url
//data.data = base64 image data
})
\u launchEditor()
.then(功能(数据){
//data.url=creativesdk保存的图像url
//data.data=base64图像数据
})