Commit d79be4e2 by 任晓松

Rollback

parent c4ddbc72
...@@ -349,13 +349,11 @@ class ImageHandleApi extends ApiBase{ ...@@ -349,13 +349,11 @@ class ImageHandleApi extends ApiBase{
// var result=await this.ossClient.downfile(jpgpath); // var result=await this.ossClient.downfile(jpgpath);
var downClient=system.getObject("util.restClient"); var downClient=system.getObject("util.restClient");
var result=await downClient.execDownload(jpgpath,destfile); var result=await downClient.execDownload(jpgpath,destfile);
console.log(result,'111111111111111111111')
var jpgpathtmp="/tmp/"+basename; var jpgpathtmp="/tmp/"+basename;
var bkimgpath="/tmp/bk"+basename+".jpg"; var bkimgpath="/tmp/bk"+basename+".jpg";
var comimgpath="/tmp/comimg"+basename+".jpg"; var comimgpath="/tmp/comimg"+basename+".jpg";
var size=await this._getImgSize(jpgpathtmp); var size=await this._getImgSize(jpgpathtmp);
console.log(size,'22222222222222222')
var maxSize=Math.max(size.height,size.width); var maxSize=Math.max(size.height,size.width);
var scale=0;//不缩放 var scale=0;//不缩放
if(maxSize<400){ if(maxSize<400){
...@@ -368,22 +366,17 @@ class ImageHandleApi extends ApiBase{ ...@@ -368,22 +366,17 @@ class ImageHandleApi extends ApiBase{
} }
//生成背景图片 //生成背景图片
var bkimg=await this._onMakeTmBkPic(maxSize,bkimgpath); var bkimg=await this._onMakeTmBkPic(maxSize,bkimgpath);
console.log(bkimg,'3333333333333333333333333333')
//合成图像 //合成图像
var comimg=await this._composeImg(scale,maxSize,jpgpathtmp,bkimgpath,comimgpath); var comimg=await this._composeImg(scale,maxSize,jpgpathtmp,bkimgpath,comimgpath);
console.log(comimg,'4444444444444444444444444')
//上传覆盖元先的路径 //上传覆盖元先的路径
var rtn=await this.ossClient.upfile(colorjpgpath,comimgpath); var rtn=await this.ossClient.upfile(colorjpgpath,comimgpath);
console.log(rtn,'555555555555555555555555555')
fs.unlink(jpgpathtmp,function(err){}); fs.unlink(jpgpathtmp,function(err){});
fs.unlink(bkimgpath,function(err){}); fs.unlink(bkimgpath,function(err){});
// fs.unlink(comimgpath,function(err){}); // fs.unlink(comimgpath,function(err){});
var grayimg=await this._grayImg(comimgpath); var grayimg=await this._grayImg(comimgpath);
console.log(grayimg,'666666666666666666666666')
var blackjpgpath = await this.getUidStr(20,62)+".jpg"; var blackjpgpath = await this.getUidStr(20,62)+".jpg";
blackjpgpath = "zc_black"+blackjpgpath; blackjpgpath = "zc_black"+blackjpgpath;
var rtn2=await this.ossClient.upfile(blackjpgpath,comimgpath); var rtn2=await this.ossClient.upfile(blackjpgpath,comimgpath);
console.log(rtn2,'77777777777777777777777777')
fs.unlink(comimgpath,function(err){}); fs.unlink(comimgpath,function(err){});
return system.getResult2({"url":rtn.url,"url2":rtn2.url},null); return system.getResult2({"url":rtn.url,"url2":rtn2.url},null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment