Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
c0da3c11
Commit
c0da3c11
authored
Dec 17, 2019
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imghandle.js
parent
8f44edcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
25 deletions
+14
-25
igirl-zcapi/app/base/api/impl/tool/imghandle.js
+14
-25
No files found.
igirl-zcapi/app/base/api/impl/tool/imghandle.js
View file @
c0da3c11
...
...
@@ -335,6 +335,14 @@ class ImageHandleApi extends ApiBase{
//标准商标图样上传(生成黑白商标,调整商标宽高 使其合规)
async
uploadStandardTm
(
obj
){
var
jpgpath
=
obj
.
jpgpath
;
var
colorjpgpath
=
await
this
.
getUidStr
(
20
,
62
)
+
".jpg"
;
colorjpgpath
=
"zc_color"
+
colorjpgpath
;
if
(
jpgpath
){
var
arr
=
jpgpath
.
split
(
"/"
);
if
(
arr
&&
arr
.
length
>
0
){
colorjpgpath
=
arr
[
arr
.
length
-
1
];
}
}
// var basename=obj.jpgpath.substring(0,obj.jpgpath.lastIndexOf("."));
var
basename
=
await
this
.
getUidStr
(
20
,
62
)
+
".jpg"
;
var
destfile
=
"/tmp/"
+
basename
;
...
...
@@ -361,12 +369,13 @@ class ImageHandleApi extends ApiBase{
//合成图像
var
comimg
=
await
this
.
_composeImg
(
scale
,
maxSize
,
jpgpathtmp
,
bkimgpath
,
comimgpath
);
//上传覆盖元先的路径
var
rtn
=
await
this
.
ossClient
.
upfile
(
jpgpath
,
comimgpath
);
var
rtn
=
await
this
.
ossClient
.
upfile
(
color
jpgpath
,
comimgpath
);
fs
.
unlink
(
jpgpathtmp
,
function
(
err
){});
fs
.
unlink
(
bkimgpath
,
function
(
err
){});
// fs.unlink(comimgpath,function(err){});
var
grayimg
=
await
this
.
_grayImg
(
comimgpath
);
var
blackjpgpath
=
await
this
.
getUidStr
(
20
,
62
)
+
".jpg"
;
blackjpgpath
=
"zc_black"
+
blackjpgpath
;
var
rtn2
=
await
this
.
ossClient
.
upfile
(
blackjpgpath
,
comimgpath
);
fs
.
unlink
(
comimgpath
,
function
(
err
){});
return
system
.
getResult2
({
"url"
:
rtn
.
url
,
"url2"
:
rtn2
.
url
},
null
);
...
...
@@ -394,28 +403,8 @@ class ImageHandleApi extends ApiBase{
}
module
.
exports
=
ImageHandleApi
;
// var t=new ImageHandleApi();
//
// t.
makeDeleForTM({"url":"http://192.168.18.40:3000/mobile#/products/createwts/10711536633793138
"}).then(d=>{
// console.log(d);
// t.
uploadStandardTm({"jpgpath":"https://gsb-zc.oss-cn-beijing.aliyuncs.com//zc_picUrl2055157656303330920191117.jpg
"}).then(d=>{
// console.log(d
,"dddddddddddddddddddddddddddddddd"
);
// });
// t.onLineMakeTM("hello","/tmp/a.jpg").then(f=>{
// console.log(f);
// });
// t.adjustTMSize({
// appKey:"wx76a324c5d201d1a4",
// jpgpath:"zc_1158153631265738720187173057387ban4.jpg"
// }).then(d=>{
// console.log(d);
// });
// t.toblack({
// appKey:"wx76a324c5d201d1a4",
// jpgpath:"zc_1158153631265738720187173057387ban4.jpg"
// }).then(d=>{
// console.log(d);
// });
// t._scaleImg("/tmp/a.jpg",400).then(d=>{
// console.log(d);
// });
// t._grayImg("/tmp/b.png").then(d=>{
// console.log(d);
// });
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment