Results 1 to 6 of 6

Thread: Need Help with Javascript Image to base64 Converter

  1. #1
    Join Date
    Sep 2011

    Post Need Help with Javascript Image to base64 Converter

    Good Day! I am a beginner in using JAVASCRIPT and I'm trying to create a form where the user will upload a file/binary file (specifically an image - JPEG, PNG & GIF) and convert it to base64 format (which actually makes it's file size 33% larger), but, with only one file - form.html. It is difficult because it should run on the client-side and I cannot use PHP as a programming language. On the second hand, I have read that there are built in codes on browsers for converting "text" to base64 but only runs on specific browsers (I can only use Internet Explorer).

    I was wondering if you can help me with it. I found an open-source software that converts text into base64 and it works perfectly. But It is pretty unnecessary to create much of a process on single html files, or else it would look like a button field rather than a form.

    I attached a file of what I did.

    I need all the help I can get. Thank you!

    James M.
    Attached Images Attached Images

  2. #2
    Join Date
    Sep 2011

    Unhappy I need some help here please?

    I need this ASAP.. Please help me!

  3. #3
    Join Date
    Oct 2010
    Versailles, France
    Javascript is not made to work with files on the client-side and is probably not the good track...
    Last edited by 007Julien; 09-21-2011 at 06:38 AM.

  4. #4
    Join Date
    Dec 2003
    Bucharest, ROMANIA

  5. #5
    Join Date
    Dec 2010

  6. #6
    Join Date
    Jul 2008
    urbana, il
    just load the image into a canvas and use .toDataURL() on the canvas context to grab the file as a base64 jpeg or png.

    that won't work in ie, but you already have an ie solution...

    the other option is to use a binary ajax request and js-based base64 encoder. FF+chrome have window.btoa() for this, but you can get the function with pure js as well; a couple scripts are floating around. test them out, i remember one being 20X faster than another...
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center