-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquick.js
More file actions
51 lines (44 loc) · 1.11 KB
/
quick.js
File metadata and controls
51 lines (44 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var fs = require('fs');
var cloudinary = require('cloudinary').v2;
var uploads = {};
const randomImage = 'https://picsum.photos/1080/1080/?random'
const text = process.argv
.slice(2,process.argv.length)
.join(' ');
cloudinary.uploader.upload(randomImage,
{
"tags":"til",
"width":1600,
"height":1600,
},
function(err,image){
if (err){ console.warn(err);}
console.log("* "+image.public_id);
console.log("* "+image.url);
waitForAllUploads("image",err,image);
});
function waitForAllUploads(id,err,image){
uploads[id] = image;
var ids = Object.keys(uploads);
if (ids.length==1){
console.log();
console.log ('** uploaded all files ('+ids.join(',')+') to cloudinary');
performTransformations();
}
}
function performTransformations(){
var finalImage = cloudinary.url(uploads.image.public_id, {transformation: [
{
overlay: "boxOverlay",
opacity: 55,
crop: "scale"
},
{
overlay: "text:Crete%20Round_100:" + text,
color: "white",
width: 1000,
crop: "fit"
},
]});
console.log('finalImage: ', finalImage);
}