Sha256: 1b629784a67af0e7821bc1e15186aae38a5bfb1bee289d907097a172e654d0d3

Contents?: true

Size: 1.41 KB

Versions: 213

Compression:

Stored size: 1.41 KB

Contents

zipFileType = 'svg'
renderFileTypes = ['svg']
const batchConversion = async (file, indexValue) => {
  return new Promise((resolve, reject) => {
    if (file) {
      const reader = new FileReader()
      reader.readAsDataURL(file)
      reader.onload = (e) => {
        if (e.target.result) {
          let image = new Image()
          let canvas = document.createElement('canvas')
          canvas.setAttribute('id', 'canvas-img')
          let ctx = canvas.getContext('2d')
          image.onload = () => {
            canvas.width = image.width
            canvas.height = image.height
            // counter.innerHTML = e.target.value + "%"
            let filters = document.querySelector('#applyFilter')
            if (filters.getAttribute('data-filter') === 'opacity') {
              ctx.globalAlpha = filters.value
              ctx.drawImage(image, 0, 0, canvas.width, canvas.height)
              resolve([indexValue, canvas.toDataURL('image/png'), 'image'])
            } else {
              ctx.filter =
                filters.getAttribute('data-filter') +
                '(' +
                filters.value +
                filters.getAttribute('data-scale') +
                ') '
              ctx.drawImage(image, 0, 0, canvas.width, canvas.height)
              resolve([indexValue, canvas.toDataURL('image/png'), 'image'])
            }
          }
          image.src = e.target.result
        }
      }
    }
  })
}

Version data entries

213 entries across 213 versions & 1 rubygems

Version Path
appscms-tools-theme-4.9.7 assets/js/testing-batch.js
appscms-tools-theme-4.9.6 assets/js/testing-batch.js
appscms-tools-theme-4.9.5 assets/js/testing-batch.js
appscms-tools-theme-4.9.4 assets/js/testing-batch.js
appscms-tools-theme-4.9.3 assets/js/testing-batch.js
appscms-tools-theme-4.9.2 assets/js/testing-batch.js
appscms-tools-theme-4.9.1 assets/js/testing-batch.js
appscms-tools-theme-4.9.0 assets/js/testing-batch.js
appscms-tools-theme-4.8.9 assets/js/testing-batch.js
appscms-tools-theme-4.8.8 assets/js/testing-batch.js
appscms-tools-theme-4.8.7 assets/js/testing-batch.js
appscms-tools-theme-4.8.6 assets/js/testing-batch.js
appscms-tools-theme-4.8.5 assets/js/testing-batch.js
appscms-tools-theme-4.8.4 assets/js/testing-batch.js
appscms-tools-theme-4.8.3 assets/js/testing-batch.js
appscms-tools-theme-4.8.2 assets/js/testing-batch.js
appscms-tools-theme-4.8.1 assets/js/testing-batch.js
appscms-tools-theme-4.8.0 assets/js/testing-batch.js
appscms-tools-theme-4.7.9 assets/js/testing-batch.js
appscms-tools-theme-4.7.8 assets/js/testing-batch.js