appscms-tools-theme 2.2.1 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/assets/js/frame.js CHANGED
@@ -1,237 +1,245 @@
1
- const getScript = document.currentScript
2
- const pageTool = getScript.dataset.tool
3
- const lang = getScript.dataset.lang
4
- const inputBox = document.querySelector('#Inputbox')
5
- const fileDropBox = document.querySelector('.custom-box')
6
- const cropModal = document.querySelector('.crop-image-modal-container')
7
- const workspace = document.getElementById('workspace')
8
- const canvasPanel = document.getElementById('canvas-panel')
9
- const download = document.querySelector('#download-button')
10
- const form = document.querySelector('#effect-form')
11
- let files = []
12
- let cropWidth = null
13
- let cropHeight = null
14
- let cropper = null
15
- let cropInputWidth = null
16
- let index = 0
17
- let cropInputHeight = null
18
- let image = null
19
- const showLoader = () => {
20
- showLoading()
21
- }
22
- const closeLoader = () => {}
23
- const clickInput = (e) => {
24
- console.log(`#file-${e.dataset.index}`)
25
- document.querySelector(`#file-${e.dataset.index}`).click()
26
- }
27
- let featureData = null
28
-
29
- fetch('/assets/js/photo-effects.json')
30
- .then((response) => response.json())
31
- .then((data) => {
32
- featureData = data.find((i) => i.name === form.dataset.featureName)
33
- console.log(featureData)
34
- })
35
- const fileOnChange = (e) => {
36
- index = Number(e.dataset.index)
37
- let reader = new FileReader()
38
- reader.onload = (event) => {
39
- cropModal.style.display = 'flex'
40
- if (cropper === null) {
41
- cropImage(event.target.result, e.id)
42
- } else {
43
- updateCropper(event.target.result, e.id)
44
- }
45
- }
46
- reader.readAsDataURL(e.files[0])
47
- }
48
- const closeModal = () => {
49
- cropModal.style.display = 'none'
50
- }
51
- form.addEventListener('submit', (e) => {
52
- e.preventDefault()
53
- drawImage()
54
- })
55
- const drawInputImage = (ctx, item, indexValue, canvas, image) => {
56
- console.log(ctx)
57
- return new Promise((resolve, reject) => {
58
- let image = document.createElement('img')
59
- image.src = files[indexValue]
60
- image.onload = () => {
61
- image.width = Number(item.width)
62
- image.height = Number(item.height)
63
- if (item.filter) {
64
- ctx.filter = item.filter
65
- }
66
- ctx.drawImage(
67
- image,
68
- Number(item.x),
69
- Number(item.y),
70
- image.width,
71
- image.height
72
- )
73
-
74
- if (item.rotate) {
75
- drawRotated(item.rotate, ctx, canvas, image)
76
- }
77
- resolve()
78
- }
79
- })
80
- }
81
- const drawRotated = (degrees, ctx, canvas, image) => {
82
- console.log(image)
83
- ctx.clearRect(0, 0, canvas.width, canvas.height)
84
-
85
- // save the unrotatedctx of the canvas so we can restore it later
86
- // the alternative is to untranslate & unrotate after drawing
87
- ctx.save()
88
-
89
- // move to the center of the canvas
90
- // ctx.translate(canvas.width / 2, canvas.height / 2)
91
-
92
- // rotate the canvas to the specified degrees
93
- ctx.rotate((degrees * Math.PI) / 180)
94
-
95
- // draw the image
96
- // since thectx is rotated, the image will be rotated also
97
- ctx.drawImage(image, -image.width / 2, -image.width / 2)
98
-
99
- // we’re done with the rotating so restore the unrotatedctx
100
- ctx.restore()
101
- }
102
- const drawImage = () => {
103
- let img = new Image()
104
- img.src = featureData.effectImagePath
105
- var canvas = document.createElement('canvas')
106
- var ctx = canvas.getContext('2d')
107
- img.onload = () => {
108
- canvas.width = img.width
109
- canvas.height = img.height
110
- Promise.all(
111
- featureData.elements.map((item, indexValue) => {
112
- if (item.type === 'image') {
113
- return new Promise((resolve, reject) => {
114
- drawInputImage(ctx, item, indexValue, canvas).then(() => {
115
- resolve()
116
- })
117
- })
118
- }
119
- })
120
- ).then(() => {
121
- ctx.filter = 'none'
122
- ctx.drawImage(img, 0, 0, canvas.width, canvas.height)
123
- featureData.elements.map((item, indexValue) => {
124
- if (item.type === 'text') {
125
- let myFont = new FontFace(item.font, `url(${item.fontPath})`)
126
- myFont.load().then(function (font) {
127
- document.fonts.add(font)
128
- ctx.font = `${item.fontSize}px ${item.font}`
129
- if (item.shadowColor) {
130
- ctx.shadowColor = `${item.shadowColor}`
131
- }
132
- if (item.rotate) {
133
- ctx.rotate((item.rotate * Math.PI) / 180)
134
- }
135
- if (item.shadowOffsetX) {
136
- ctx.shadowOffsetX = 3
137
- }
138
- if (item.shadowOffsetY) {
139
- ctx.shadowOffsetY = 3
140
- }
141
- if (item.shadowBlur) {
142
- ctx.shadowBlur = 2
143
- }
144
- ctx.fillStyle = `${item.color}`
145
- ctx.fillText(
146
- document.querySelector(`#${item.id}`).value,
147
- item.x,
148
- item.y
149
- )
150
- })
151
- }
152
- if (item.type === 'rectangle') {
153
- }
154
- })
155
- canvasPanel.innerHTML = ''
156
- canvasPanel.appendChild(canvas)
157
- workspace.style.display = 'block'
158
- })
159
- }
160
- }
161
- const cropImage = (result, id) => {
162
- let image = new Image()
163
- image.onload = () => {
164
- let img = document.createElement('img')
165
- img.src = result
166
- img.id = 'image'
167
- document.querySelector('.crop-image-modal-body').appendChild(img)
168
- cropper = new Cropper(img, {
169
- viewMode: 3,
170
- ready() {
171
- console.log(id)
172
- let find = featureData.elements.find((i) => i.id === id)
173
- console.log(find)
174
- cropper.setAspectRatio(Number(find.width) / Number(find.height))
175
- cropModal.style.display = 'flex'
176
- this.cropper.crop()
177
- },
178
- crop(event) {
179
- cropWidth = Math.round(event.detail.width)
180
- cropHeight = Math.round(event.detail.height)
181
- },
182
- })
183
- }
184
- image.src = result
185
- }
186
- const updateCropper = (result, id) => {
187
- cropper.destroy()
188
- document.querySelector('.crop-image-modal-body').innerHTML = ''
189
- cropImage(result, id)
190
- }
191
- document.querySelector('#crop').addEventListener('click', () => {
192
- let cropperImg = cropper
193
- .getCroppedCanvas({
194
- width: cropWidth,
195
- height: cropHeight,
196
- })
197
- .toDataURL()
198
- files[index - 1] = cropperImg
199
- cropModal.style.display = 'none'
200
- })
201
- let inputFile = ''
202
- const handleFile = (file) => {
203
- cropModal.style.display = 'flex'
204
- document.querySelector('#file-loader').style.display = 'flex'
205
- document.querySelector('.file-input').style.display = 'none'
206
- inputFile = file
207
- if (file) {
208
- const reader = new FileReader()
209
- reader.onload = (e) => {
210
- if (e.target.result) {
211
- cropImage(e.target.result)
212
- }
213
- }
214
- reader.readAsDataURL(file)
215
- }
216
- }
217
- const showLoading = () => {
218
- document.querySelector('#file-loader').style.display = 'flex'
219
- document.querySelector('.file-input').style.display = 'none'
220
- }
221
- const stopLoading = () => {
222
- fileDropBox.style.display = 'none'
223
- }
224
- download.addEventListener('click', () => {
225
- let canvas = document.querySelector('canvas')
226
- let url = canvas.toDataURL(`image/png`)
227
- let a = document.createElement('a')
228
- a.href = url
229
- a.download = `safeimagekit-border-image.${inputFile.type.split('/')[1]}`
230
- document.body.appendChild(a)
231
- a.click()
232
- if (lang === 'en') {
233
- window.location.href = `/download?tool=${pageTool}`
234
- } else {
235
- window.location.href = `/${lang}/download?tool=${pageTool}`
236
- }
237
- })
1
+ const getScript = document.currentScript
2
+ const pageTool = getScript.dataset.tool
3
+ const lang = getScript.dataset.lang
4
+ const inputBox = document.querySelector('#Inputbox')
5
+ const fileDropBox = document.querySelector('.custom-box')
6
+ const cropModal = document.querySelector('.crop-image-modal-container')
7
+ const workspace = document.getElementById('workspace')
8
+ const canvasPanel = document.getElementById('canvas-panel')
9
+ const download = document.querySelector('#download-button')
10
+ const form = document.querySelector('#effect-form')
11
+ let files = []
12
+ let cropWidth = null
13
+ let cropHeight = null
14
+ let cropper = null
15
+ let cropInputWidth = null
16
+ let index = 0
17
+ let cropInputHeight = null
18
+ let image = null
19
+ const showLoader = () => {
20
+ showLoading()
21
+ }
22
+ const closeLoader = () => {}
23
+ const clickInput = (e) => {
24
+ console.log(`#file-${e.dataset.index}`)
25
+ document.querySelector(`#file-${e.dataset.index}`).click()
26
+ }
27
+ let featureData = null
28
+
29
+ fetch('/assets/js/photo-effects.json')
30
+ .then((response) => response.json())
31
+ .then((data) => {
32
+ featureData = data.find((i) => i.name === form.dataset.featureName)
33
+ console.log(featureData)
34
+ })
35
+ const fileOnChange = (e) => {
36
+ index = Number(e.dataset.index)
37
+ let reader = new FileReader()
38
+ reader.onload = (event) => {
39
+ cropModal.style.display = 'flex'
40
+ if (cropper === null) {
41
+ cropImage(event.target.result, e.id)
42
+ } else {
43
+ updateCropper(event.target.result, e.id)
44
+ }
45
+ }
46
+ reader.readAsDataURL(e.files[0])
47
+ }
48
+ const closeModal = () => {
49
+ cropModal.style.display = 'none'
50
+ }
51
+ form.addEventListener('submit', (e) => {
52
+ e.preventDefault()
53
+ drawImage()
54
+ })
55
+ const drawInputImage = (ctx, item, indexValue, canvas, image) => {
56
+ return new Promise((resolve, reject) => {
57
+ let image = document.createElement('img')
58
+ image.src = files[indexValue]
59
+ image.onload = () => {
60
+ image.width = Number(item.width)
61
+ image.height = Number(item.height)
62
+ if (item.filter) {
63
+ ctx.filter = item.filter
64
+ }
65
+ ctx.drawImage(
66
+ image,
67
+ Number(item.x),
68
+ Number(item.y),
69
+ image.width,
70
+ image.height
71
+ )
72
+ if (item.rotate) {
73
+ drawRotated(item.rotate, ctx, canvas, image, item)
74
+ }
75
+ resolve()
76
+ }
77
+ })
78
+ }
79
+
80
+ const drawRotated = (degrees, ctx, canvas, image, item) => {
81
+ console.log(image)
82
+ ctx.clearRect(0, 0, canvas.width, canvas.height)
83
+
84
+ // save the unrotatedctx of the canvas so we can restore it later
85
+ // the alternative is to untranslate & unrotate after drawing
86
+ ctx.save()
87
+
88
+ // move to the center of the canvas
89
+ ctx.translate(item.x, item.y)
90
+
91
+ // rotate the canvas to the specified degrees
92
+ ctx.rotate((degrees * Math.PI) / 180)
93
+
94
+ // draw the image
95
+ // since thectx is rotated, the image will be rotated also
96
+ ctx.drawImage(image, -image.width / 2, -image.width / 2)
97
+
98
+ // we’re done with the rotating so restore the unrotatedctx
99
+ ctx.restore()
100
+ }
101
+ const drawImage = () => {
102
+ let img = new Image()
103
+ img.src = featureData.effectImagePath
104
+ var canvas = document.createElement('canvas')
105
+ var ctx = canvas.getContext('2d')
106
+ img.onload = () => {
107
+ canvas.width = img.width
108
+ canvas.height = img.height
109
+ Promise.all(
110
+ featureData.elements.map((item, indexValue) => {
111
+ if (item.type === 'image') {
112
+ return new Promise((resolve, reject) => {
113
+ drawInputImage(ctx, item, indexValue, canvas).then(() => {
114
+ resolve()
115
+ })
116
+ })
117
+ }
118
+ })
119
+ ).then(() => {
120
+ ctx.filter = 'none'
121
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height)
122
+ featureData.elements.map((item, indexValue) => {
123
+ if (item.type === 'text') {
124
+ let myFont = new FontFace(item.font, `url(${item.fontPath})`)
125
+ myFont.load().then(function (font) {
126
+ document.fonts.add(font)
127
+ ctx.font = `${item.fontSize}px ${item.font}`
128
+ if (item.shadowColor) {
129
+ ctx.shadowColor = `${item.shadowColor}`
130
+ }
131
+ if (item.shadowOffsetX) {
132
+ ctx.shadowOffsetX = 3
133
+ }
134
+ if (item.shadowOffsetY) {
135
+ ctx.shadowOffsetY = 3
136
+ }
137
+ if (item.shadowBlur) {
138
+ ctx.shadowBlur = 2
139
+ }
140
+ ctx.rotate(-Math.PI / 2)
141
+ ctx.textAlign = 'center'
142
+ ctx.fillStyle = `${item.color}`
143
+ ctx.fillText(
144
+ document.querySelector(`#${item.id}`).value,
145
+ item.x,
146
+ item.y
147
+ )
148
+ })
149
+ }
150
+ if (item.type === 'rectangle') {
151
+ }
152
+ })
153
+ canvasPanel.innerHTML = ''
154
+ canvasPanel.appendChild(canvas)
155
+ workspace.style.display = 'block'
156
+ })
157
+ }
158
+ }
159
+ const cropImage = (result, id) => {
160
+ let image = new Image()
161
+ image.onload = () => {
162
+ let img = document.createElement('img')
163
+ img.src = result
164
+ img.id = 'image'
165
+ document.querySelector('.crop-image-modal-body').appendChild(img)
166
+ cropper = new Cropper(img, {
167
+ viewMode: 3,
168
+ ready() {
169
+ console.log(id)
170
+ let find = featureData.elements.find((i) => i.id === id)
171
+ console.log(find)
172
+ cropper.setAspectRatio(Number(find.width) / Number(find.height))
173
+ cropModal.style.display = 'flex'
174
+ this.cropper.crop()
175
+ },
176
+ crop(event) {
177
+ cropWidth = Math.round(event.detail.width)
178
+ cropHeight = Math.round(event.detail.height)
179
+ },
180
+ })
181
+ }
182
+ image.src = result
183
+ }
184
+ const updateCropper = (result, id) => {
185
+ cropper.destroy()
186
+ document.querySelector('.crop-image-modal-body').innerHTML = ''
187
+ cropImage(result, id)
188
+ }
189
+ document.querySelector('#crop').addEventListener('click', () => {
190
+ let cropperImg = cropper
191
+ .getCroppedCanvas({
192
+ width: cropWidth,
193
+ height: cropHeight,
194
+ })
195
+ .toDataURL()
196
+ files[index - 1] = cropperImg
197
+ cropModal.style.display = 'none'
198
+ })
199
+ let inputFile = ''
200
+ const handleFile = (file) => {
201
+ cropModal.style.display = 'flex'
202
+ document.querySelector('#file-loader').style.display = 'flex'
203
+ document.querySelector('.file-input').style.display = 'none'
204
+ inputFile = file
205
+ if (file) {
206
+ const reader = new FileReader()
207
+ reader.onload = (e) => {
208
+ if (e.target.result) {
209
+ cropImage(e.target.result)
210
+ }
211
+ }
212
+ reader.readAsDataURL(file)
213
+ }
214
+ }
215
+ const showLoading = () => {
216
+ document.querySelector('#file-loader').style.display = 'flex'
217
+ document.querySelector('.file-input').style.display = 'none'
218
+ }
219
+ const stopLoading = () => {
220
+ fileDropBox.style.display = 'none'
221
+ }
222
+ download.addEventListener('click', () => {
223
+ let canvas = document.querySelector('canvas')
224
+ let url = canvas.toDataURL(`image/png`)
225
+ let a = document.createElement('a')
226
+ a.href = url
227
+ a.download = `safeimagekit-border-image.${inputFile.type.split('/')[1]}`
228
+ document.body.appendChild(a)
229
+ a.click()
230
+ if (lang === 'en') {
231
+ window.location.href = `/download?tool=${pageTool}`
232
+ } else {
233
+ window.location.href = `/${lang}/download?tool=${pageTool}`
234
+ }
235
+ })
236
+
237
+ //
238
+ // fonts
239
+ // font rotation
240
+ // font position
241
+ // font transform
242
+
243
+ //images
244
+ //image rotation
245
+ // image rectangle with text
@@ -19,8 +19,8 @@
19
19
  "type": "text",
20
20
  "x": "100",
21
21
  "y": "100",
22
- "rotate": 10,
23
22
  "color": "red",
23
+ "rotate": 40,
24
24
  "fontFamily": "Calligraphy",
25
25
  "fontPath": "/assets/fonts/Calligraphy.ttf",
26
26
  "fontWeight": "bold",
@@ -31,7 +31,6 @@
31
31
  "imagePath": "",
32
32
  "filter": "grayscale(100%)",
33
33
  "perspective": "",
34
- "rotate": 40,
35
34
  "height": 300,
36
35
  "width": 300,
37
36
  "x": 100,
@@ -39,16 +38,16 @@
39
38
  "id": "file-3"
40
39
  },
41
40
  {
42
- "id": "text-2",
43
41
  "label": "",
42
+ "id": "text-2",
44
43
  "type": "text",
45
- "x": 100,
46
- "y": 100,
44
+ "x": "200",
45
+ "y": "200",
47
46
  "color": "red",
48
47
  "fontFamily": "Calligraphy",
49
48
  "fontPath": "/assets/fonts/Calligraphy.ttf",
50
49
  "fontWeight": "bold",
51
- "fontSize": 0
50
+ "fontSize": 50
52
51
  }
53
52
  ]
54
53
  }
@@ -0,0 +1,28 @@
1
+ const opacity = document.querySelector("#opacity")
2
+ const batchConversion = async (file, indexValue) => {
3
+ return new Promise((resolve, reject) => {
4
+ if (file) {
5
+ const reader = new FileReader()
6
+ reader.readAsDataURL(file)
7
+ reader.onload = (e) => {
8
+ if (e.target.result) {
9
+ let image = new Image()
10
+ let canvas = document.createElement('canvas')
11
+ canvas.setAttribute('id', 'canvas-img')
12
+ let ctx = canvas.getContext('2d')
13
+ image.onload = () => {
14
+ canvas.width = image.width
15
+ canvas.height = image.height
16
+ ctx.globalAlpha = opacity.value
17
+ ctx.drawImage(image, 0, 0, canvas.width, canvas.height)
18
+ resolve([indexValue, canvas.toDataURL('image/png'), "image"])
19
+ }
20
+ image.src = e.target.result
21
+ }
22
+ }
23
+ }
24
+ })
25
+ }
26
+
27
+
28
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appscms-tools-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - vivek-appscms
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-13 00:00:00.000000000 Z
11
+ date: 2022-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -2359,6 +2359,7 @@ files:
2359
2359
  - _data/disclaimer/en/disclaimer.json
2360
2360
  - _data/download/en/download.json
2361
2361
  - _data/feature/en/allele-frequency.json
2362
+ - _data/feature/en/batch-conversion.json
2362
2363
  - _data/feature/en/compress-pdf.json
2363
2364
  - _data/feature/en/split-pdf.json
2364
2365
  - _data/feature/en/theframe.json
@@ -2388,6 +2389,7 @@ files:
2388
2389
  - _includes/alternates/alternates.html
2389
2390
  - _includes/author_bio.html
2390
2391
  - _includes/authors/authors.html
2392
+ - _includes/batch-conversion.html
2391
2393
  - _includes/cssfile/links.html
2392
2394
  - _includes/custom-head.html
2393
2395
  - _includes/customblog/recentposts.html
@@ -2421,6 +2423,7 @@ files:
2421
2423
  - _includes/share/socialshare.html
2422
2424
  - _includes/staticfooter.html
2423
2425
  - _layouts/aboutUs.html
2426
+ - _layouts/batch.html
2424
2427
  - _layouts/blog.html
2425
2428
  - _layouts/calculator.html
2426
2429
  - _layouts/categories.html
@@ -2444,6 +2447,7 @@ files:
2444
2447
  - assets/cloud.svg
2445
2448
  - assets/cross.svg
2446
2449
  - assets/css/adblocker.css
2450
+ - assets/css/batch.css
2447
2451
  - assets/css/blog.css
2448
2452
  - assets/css/bootstrap.min.css
2449
2453
  - assets/css/calculators.css
@@ -2573,9 +2577,15 @@ files:
2573
2577
  - assets/images/Nikita.webp
2574
2578
  - assets/images/abp.svg
2575
2579
  - assets/images/adblock.svg
2580
+ - assets/images/add-image.png
2581
+ - assets/images/add.png
2576
2582
  - assets/images/alka.webp
2577
2583
  - assets/images/avatar.png
2578
2584
  - assets/images/balark.jpeg
2585
+ - assets/images/cloud-computing.png
2586
+ - assets/images/convert.png
2587
+ - assets/images/download.png
2588
+ - assets/images/file.png
2579
2589
  - assets/images/fileformat.webp
2580
2590
  - assets/images/gallary.png
2581
2591
  - assets/images/keshav.webp
@@ -2583,19 +2593,27 @@ files:
2583
2593
  - assets/images/logo.png
2584
2594
  - assets/images/paavan.webp
2585
2595
  - assets/images/rating.png
2596
+ - assets/images/safeimagekit. (2).png
2597
+ - assets/images/safeimagekit. (3).png
2598
+ - assets/images/safeimagekit..png
2599
+ - assets/images/safeimagekit.png
2586
2600
  - assets/images/safevideoconverter.svg
2587
2601
  - assets/images/siddhika.jpeg
2588
2602
  - assets/images/sona.jpeg
2603
+ - assets/images/spinner.gif
2589
2604
  - assets/images/together_forever.png
2605
+ - assets/images/trust.svg
2590
2606
  - assets/images/udit.jpeg
2591
2607
  - assets/images/udit.jpg
2592
2608
  - assets/images/udit.png
2593
2609
  - assets/images/uo.svg
2610
+ - assets/images/vectorpaint.svg
2594
2611
  - assets/instagram.svg
2595
2612
  - assets/js/TopScroll.js
2596
2613
  - assets/js/adBlocker.js
2597
2614
  - assets/js/ads.js
2598
2615
  - assets/js/append-div.js
2616
+ - assets/js/batch.js
2599
2617
  - assets/js/featureResult.js
2600
2618
  - assets/js/frame.js
2601
2619
  - assets/js/googledrive.js
@@ -2604,6 +2622,7 @@ files:
2604
2622
  - assets/js/multiselect.js
2605
2623
  - assets/js/photo-effects.json
2606
2624
  - assets/js/redirectResult.js
2625
+ - assets/js/testing-batch.js
2607
2626
  - assets/js/theme.js
2608
2627
  - assets/linkdin.svg
2609
2628
  - assets/noserverupload.svg