Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8

Thread: BASE64 to Blob

  • Thread Tools
  • Rate This Thread
  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Posts
    173
    Thanks
    0
    Thanked 4 Times in 4 Posts

    BASE64 to Blob

    I'm working on an app. I'm allowing users to upload photos which takes the photo, re-sizes the quality and size in canvas, then saves it as a base64 to store into the DB. When I pull it back out, should I convert it to a blob or should i just use the base64 string as an image src?
    Check out my blog and portfolio at http://calebprenger.com

  2. #2
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    438
    Thanks
    10
    Thanked 62 Times in 61 Posts
    base64 is a text, not binary AFAIK.

  3. #3
    Regular Coder
    Join Date
    Jun 2010
    Posts
    173
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Quote Originally Posted by hdewantara View Post
    base64 is a text, not binary AFAIK.
    That wasn't an answer. FYI base64 can be converted to binary.
    Check out my blog and portfolio at http://calebprenger.com

  4. #4
    Regular Coder hdewantara's Avatar
    Join Date
    Aug 2009
    Location
    Jakarta, Indonesia.
    Posts
    438
    Thanks
    10
    Thanked 62 Times in 61 Posts
    Yeah, right.
    but why? img src can accept image filename or... base64. Have a loook in here:
    https://developer.mozilla.org/en-US/...e_via_data_URL

  5. #5
    Regular Coder
    Join Date
    Jun 2010
    Posts
    173
    Thanks
    0
    Thanked 4 Times in 4 Posts
    My question was, is it more resource intensive because of the length of base64?
    Check out my blog and portfolio at http://calebprenger.com

  6. #6
    Regular Coder
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    311
    Thanks
    0
    Thanked 42 Times in 40 Posts
    Given you are posting this under JS programming, I'd suggest sticking with base64 just because JavaScript inhales upon the proverbial equine of short stature when it comes to dealing with binary encoded data.

    But the question really is WHAT sort of database are you storing it in, HOW are you using it, and why are you putting it into a DB instead of a real file in the first place?

    Still, there is toBlob -- if you want to use it as blob I'd be doing that before storing it just to save that extra 2/8ths+ overhead... but really things like canvas to image illustrates quite well how pathetic JS implementations still are for things like this.
    From time to time the accessibility of websites must be refreshed with the blood of designers and owners; it is its natural manure.
    http://www.cutcodedown.com

  7. #7
    Regular Coder
    Join Date
    Jun 2010
    Posts
    173
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Quote Originally Posted by deathshadow View Post
    Given you are posting this under JS programming, I'd suggest sticking with base64 just because JavaScript inhales upon the proverbial equine of short stature when it comes to dealing with binary encoded data.

    But the question really is WHAT sort of database are you storing it in, HOW are you using it, and why are you putting it into a DB instead of a real file in the first place?

    Still, there is toBlob -- if you want to use it as blob I'd be doing that before storing it just to save that extra 2/8ths+ overhead... but really things like canvas to image illustrates quite well how pathetic JS implementations still are for things like this.
    Thanks for no answer...
    Check out my blog and portfolio at http://calebprenger.com

  8. #8
    Regular Coder
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    311
    Thanks
    0
    Thanked 42 Times in 40 Posts
    Quote Originally Posted by pdiddles03 View Post
    Thanks for no answer...
    Sorry, but could you clarify/answer the three questions in the middle of my response? You failed to provide enough information on WHAT, HOW or even WHY in the first place for anyone to give you a meaningful answer!
    From time to time the accessibility of websites must be refreshed with the blood of designers and owners; it is its natural manure.
    http://www.cutcodedown.com


 

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
  •