How to zip an img from file input with JSZIP

I try to zip a file from a file input element, but it does not work. How can I do it by using Javascript?

var input = document.getElementById("id1");
const filereader = new FileReader();
filereader.onload = function() {
  zip.file("picture.png", filereader.result, {binary: true});
}
filereader.readAsDataURL(input.files[0]);
<input type="file" id="id1" style="border-radius: 0.1px; width: 40%;" accept="image/*">

75 thoughts on “How to zip an img from file input with JSZIP”

  1. Pingback: keto ramen
  2. You really make it seem really easy along with your presentation but I find
    this matter to be actually one thing which I believe I’d never understand.
    It kind of feels too complex and extremely broad for me.
    I am looking forward in your subsequent post, I’ll attempt to get the dangle of it!

    Reply
  3. Hello there! Quick question that’s completely off topic.

    Do you know how to make your site mobile friendly? My website looks weird
    when browsing from my iphone. I’m trying to find a template or plugin that might
    be able to correct this issue. If you have any suggestions, please share.
    With thanks!

    Reply
  4. Do you have a spam problem on this website; I
    also am a blogger, and I was curious about your situation; many
    of us have created some nice methods and we are looking to trade solutions with other folks, please shoot me an e-mail if interested.

    Reply
  5. My coder is trying to convince me to move
    to .net from PHP. I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using Movable-type on several
    websites for about a year and am anxious about switching
    to another platform. I have heard good things about blogengine.net.

    Is there a way I can transfer all my wordpress posts into it?
    Any help would be greatly appreciated! quest bars
    http://j.mp/3C2tkMR quest bars

    Reply
  6. Howdy, i read your blog occasionally and i
    own a similar one and i was just wondering if you get a lot of spam feedback?
    If so how do you prevent it, any plugin or anything you can suggest?
    I get so much lately it’s driving me insane so any
    help is very much appreciated. ps4 https://j.mp/3nkdKIi ps4

    Reply
  7. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored material stylish.

    nonetheless, you command get bought an impatience over that you wish be delivering the following.
    unwell unquestionably come more formerly again as exactly the same
    nearly a lot often inside case you shield this increase.

    Reply
  8. Today, I went to the beach with my kids. I found a
    sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her ear. She never
    wants to go back! LoL I know this is totally off topic but I had to tell
    someone!

    Reply
  9. Just desire to say your article is as surprising.
    The clarity on your publish is simply cool and i could suppose you are a professional in this subject.
    Well with your permission let me to take hold of your
    feed to stay up to date with drawing close post. Thank
    you a million and please carry on the rewarding work.

    Reply
  10. Having read this I believed it was really enlightening.
    I appreciate you taking the time and energy to
    put this informative article together. I once again find myself spending way too
    much time both reading and leaving comments.

    But so what, it was still worthwhile!

    Reply
  11. I’m amazed, I have to admit. Rarely do I encounter a blog that’s equally educative
    and amusing, and without a doubt, you have hit the nail on the head.
    The problem is an issue that too few people are speaking
    intelligently about. Now i’m very happy I stumbled across
    this during my hunt for something concerning this.

    Reply

Leave a Comment