Browse Source

Fixes in subtitles for images in portrate mode

Dmitriy Slipak 4 years ago
parent
commit
a074b2eff5
5 changed files with 17 additions and 221 deletions
  1. 5 0
      client/theme-editor.js
  2. 0 5
      package-lock.json
  3. 0 1
      package.json
  4. 11 0
      server/index.js
  5. 1 215
      settings/themes.json

+ 5 - 0
client/theme-editor.js View File

33
     };
33
     };
34
     URL.revokeObjectURL(this.src);
34
     URL.revokeObjectURL(this.src);
35
 
35
 
36
+    var subtitleLeft, subtitleRight;
36
     if (sizes.width > sizes.height) {
37
     if (sizes.width > sizes.height) {
37
       if (sizes.width > 1280) {
38
       if (sizes.width > 1280) {
38
         sizes.width = 1280;
39
         sizes.width = 1280;
46
       }
47
       }
47
       if (sizes.width > 720) {
48
       if (sizes.width > 720) {
48
         sizes.width = 720;
49
         sizes.width = 720;
50
+        subtitleLeft = sizes.width/2;
51
+        subtitleRight = sizes.width-20;
52
+        formData.append("newSubtitleLeft", subtitleLeft);
53
+        formData.append("newSubtitleRight", subtitleRight);
49
       }
54
       }
50
     }
55
     }
51
     
56
     

+ 0 - 5
package-lock.json View File

4321
       "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
4321
       "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=",
4322
       "dev": true
4322
       "dev": true
4323
     },
4323
     },
4324
-    "resize-image": {
4325
-      "version": "0.1.0",
4326
-      "resolved": "https://registry.npmjs.org/resize-image/-/resize-image-0.1.0.tgz",
4327
-      "integrity": "sha512-78cWCEX/IupMCwKi5Gg5gxjOZKoN6UXinL2eVOB4xzyG2QNjq64z6pJBnyBKg5/BsjEosLz1co5e3DHr99TgFg=="
4328
-    },
4329
     "resolve": {
4324
     "resolve": {
4330
       "version": "1.15.0",
4325
       "version": "1.15.0",
4331
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz",
4326
       "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.0.tgz",

+ 0 - 1
package.json View File

37
     "multer": "^1.1.0",
37
     "multer": "^1.1.0",
38
     "node-ffprobe": "^1.2.2",
38
     "node-ffprobe": "^1.2.2",
39
     "redis": "^2.4.2",
39
     "redis": "^2.4.2",
40
-    "resize-image": "^0.1.0",
41
     "rimraf": "^2.5.0",
40
     "rimraf": "^2.5.0",
42
     "smartquotes": "^1.0.0",
41
     "smartquotes": "^1.0.0",
43
     "subtitle": "^2.0.3",
42
     "subtitle": "^2.0.3",

+ 11 - 0
server/index.js View File

87
       var width = req.body.newWidth;
87
       var width = req.body.newWidth;
88
       var height = req.body.newHeight;
88
       var height = req.body.newHeight;
89
       var themes = JSON.parse(data);
89
       var themes = JSON.parse(data);
90
+      
90
       themes[caption] = {
91
       themes[caption] = {
91
         "backgroundImage": req.file.filename,
92
         "backgroundImage": req.file.filename,
92
         "width": parseInt(width),
93
         "width": parseInt(width),
93
         "height": parseInt(height)
94
         "height": parseInt(height)
94
       };
95
       };
96
+      
97
+      var subtitleLeft = (req.body.newSubtitleLeft) ? req.body.newSubtitleLeft : 0;
98
+      var subtitleRight = (req.body.newSubtitleRight) ? req.body.newSubtitleRight : 0;
99
+      if (subtitleLeft > 0) {
100
+        themes[caption]["subtitleLeft"] = parseInt(subtitleLeft);
101
+      }
102
+      if (subtitleRight > 0) {
103
+        themes[caption]["subtitleRight"] = parseInt(subtitleRight);
104
+      }
105
+      
95
       var jt = JSON.stringify(themes);
106
       var jt = JSON.stringify(themes);
96
       fs.writeFile(themesFile, jt, "utf8", function (err) {
107
       fs.writeFile(themesFile, jt, "utf8", function (err) {
97
         if (err) {
108
         if (err) {

File diff suppressed because it is too large
+ 1 - 215
settings/themes.json