-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
photopea.js
110 lines (85 loc) · 2.78 KB
/
photopea.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
function size(){
var px = app.preferences.rulerUnits = "Pixels";
if (px == false){
alert("Had a problem, check out if is pixels!!")
} else{
alert("Enabled Tabs.")
}
// var width = new UnitValue("1080 pixels")
// var height = new UnitValue("1080 pixels")
var doc = app.activeDocument;
var width = doc.width;
var height = doc.height;
if (width == 1080 && height == 1080) {
// FEED
doc.guides.add(Direction.HORIZONTAL, 76.531);
doc.guides.add(Direction.HORIZONTAL, 1003.469);
doc.guides.add(Direction.VERTICAL, 76.531);
doc.guides.add(Direction.VERTICAL, 540.0);
doc.guides.add(Direction.VERTICAL, 1003.469);
alert("Enabled Tabs.");
}
if (width == 1080 && height == 1920) {
// STORY
doc.guides.add(Direction.VERTICAL, 540.0);
doc.guides.add(Direction.HORIZONTAL, 188);
doc.guides.add(Direction.HORIZONTAL, 1827);
doc.guides.add(Direction.VERTICAL, 67);
doc.guides.add(Direction.VERTICAL, 1046.5);
alert("Enabled Tabs.");
}
if (width == 2160 && height == 3840) {
// STORY
doc.guides.add(Direction.VERTICAL, 180);
doc.guides.add(Direction.HORIZONTAL, 1020);
doc.guides.add(Direction.HORIZONTAL, 2820);
doc.guides.add(Direction.VERTICAL, 1980);
doc.guides.add(Direction.VERTICAL, 540);
alert("Enabled Tabs.");
}
if (width == 1050 && height == 600) {
// CARD
doc.guides.add(Direction.VERTICAL, 33);
doc.guides.add(Direction.HORIZONTAL, 23.5);
doc.guides.add(Direction.HORIZONTAL, 577.5);
doc.guides.add(Direction.VERTICAL, 1024);
alert("Enabled Tabs.");
}
if (width == 6480 && height == 1068) {
// CAROSSEL - INSTAGRAM
doc.guides.add(Direction.VERTICAL, 1079.563);
doc.guides.add(Direction.HORIZONTAL, 172.969);
doc.guides.add(Direction.VERTICAL, 2160.219);
doc.guides.add(Direction.VERTICAL, 3240.656);
doc.guides.add(Direction.VERTICAL, 4319);
doc.guides.add(Direction.VERTICAL, 5400);
alert("Enabled Tabs.");
}
if (width == 1300 && height == 1300) {
// CARD
doc.guides.add(Direction.VERTICAL, 1220);
doc.guides.add(Direction.HORIZONTAL, 80);
doc.guides.add(Direction.HORIZONTAL, 650);
doc.guides.add(Direction.HORIZONTAL, 1220);
doc.guides.add(Direction.VERTICAL, 80);
alert("Enabled Tabs.");
}
if (width == 8000 && height == 2000) {
// FEED
doc.guides.add(Direction.VERTICAL, 2000);
doc.guides.add(Direction.VERTICAL, 4000);
doc.guides.add(Direction.VERTICAL, 6000);
doc.guides.add(Direction.VERTICAL, 996.125);
doc.guides.add(Direction.HORIZONTAL, 100);
doc.guides.add(Direction.HORIZONTAL, 1900);
doc.guides.add(Direction.VERTICAL, 80);
alert("Enabled Tabs.");
}
else{
alert ("check image size")
}
}
size()
if (app.preferences.rulerUnits !== Units.PIXELS){
alert("Had a problem, check the size!");
}