-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
63 lines (60 loc) · 1.64 KB
/
Copy pathindex.ts
File metadata and controls
63 lines (60 loc) · 1.64 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
52
53
54
55
56
57
58
59
60
61
62
63
import cloudinaryCore from 'cloudinary-core'
// https://cloudinary.com/documentation/javascript_integration
const cloudinary = new cloudinaryCore.Cloudinary({
cloud_name: 'pinvite', // this is the Cloudinary cloud project name at https://cloudinary.com/console
secure: true,
})
export function cloudinaryImageUrl(
title: string,
time: string,
amount: string
) {
// https://cloudinary.com/documentation/image_transformations#adding_text_captions
return cloudinary.url('background.png', {
transformation: [
{
width: 1000,
height: 400,
x: 100,
y: 50,
gravity: 'north_west',
overlay: new cloudinaryCore.TextLayer()
.fontFamily('NotoSansJP-Black.otf')
.fontSize(60)
.textAlign('left')
.text(encodeURI(title))
.toString(),
crop: 'fit',
},
{
width: 1000,
height: 100,
x: 100,
y: 400,
overlay: new cloudinaryCore.TextLayer()
.fontFamily('NotoSansJP-Black.otf')
.fontSize(60)
.textAlign('start')
.text(encodeURI('勉強会のギャラ: ' + amount + ' 円'))
.toString(),
gravity: 'north_west',
crop: 'fit',
},
{
width: 1000,
height: 94,
x: 100,
y: 500,
overlay: new cloudinaryCore.TextLayer()
.fontFamily('NotoSansJP-Black.otf')
.fontSize(60)
.textAlign('left')
.text(encodeURI('勉強会の時間: ' + time + ' 時間'))
.toString(),
gravity: 'north_west',
crop: 'fit',
},
],
})
}
export default cloudinary