No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    QUploader for images, how to compress images ?

    Framework
    4
    6
    1617
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      igor-rotaexata last edited by igor-rotaexata

      I try to compress selected images with a Image Compressor.

      So, using ‘filter’ property of QUploader, for each file, i use new ImageCompressor(file), -> return compressed file.
      but how much do I use
      The problem, ImageCompressor is a async function, need use ‘async’ and ‘await’ to wait callback from ImageCompressor, but how much i use ‘async’ in function called by ‘filter’ property, the following errors are occurred:

      Example function
      async qUploaderFilter(files) {
      // ImageCompressor logic
      …
      return files;
      },

      ERROR:

      Uncaught TypeError: e.map is not a function
      at VueComponent.__add (quasar.mat.esm.js?e083:6)
      at invoker (vue.runtime.esm.js?2b0e:2023)
      at HTMLInputElement.fn._withTask.fn._withTask (vue.runtime.esm.js?2b0e:1822)

      …
      so, exist another solution for image compression before upload?

      1 Reply Last reply Reply Quote 0
      • I
        igor-rotaexata last edited by

        Ok, i solved my problem with another way, i use the ‘:upload-factory’ property, with a promise, that contains the logic for compress image and send to server API.

        Example: [https://github.com/GastroGeek/q-uploader-upload-factory-demo/blob/master/src/pages/index.vue]

        iodoli 1 Reply Last reply Reply Quote 0
        • iodoli
          iodoli @igor-rotaexata last edited by

          @igor-rotaexata Can you share how you imported Image Compressor as a plugin? Im keep getting error like - “Cannot call a class as a function”.

          1 Reply Last reply Reply Quote 0
          • nothingismagick
            nothingismagick last edited by

            You should use https://github.com/fengyuanchen/compressorjs instead of Image Compressor because the latter is deprecated and never available. Personally, however, I prefer to work with vue-croppa: https://zhanziyang.github.io/vue-croppa/#/customization

            Same features, but a real interface.

            iodoli 1 Reply Last reply Reply Quote 2
            • iodoli
              iodoli @nothingismagick last edited by

              @nothingismagick thanks for advice, I will try to test vue-croppa now. I forgot to mention I used https://github.com/fengyuanchen/compressorjs with v0.17.20 and it gave me that error

              1 Reply Last reply Reply Quote 0
              • bjbk
                bjbk last edited by

                @nothingismagick should I just install vue-croppa as a dependency in my Quasar v1 project? What is the best way to import non Quasar vue-components?

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post