0

I am working on a Laravel platform and currently i am in a doubt whether to use Base64 to save the user profile images or store them as a url to the file. I am new with Base64 and still don't know its pros and cons. Can someone help me explain when it is good to use the Base64 and when not to?

Thanks

Nenad Kaevik
  • 94
  • 1
  • 11

1 Answers1

1

Base64 images can be statically used in limited purpose by converting image to Base64. The generated code of Base64 is large.

  1. If the images are limited then you can store to file and assess them
    1. But images are dynamic then you can use image name. And store to the database. And access them.
    2. In case of Base64 the size is large of the code but cannot store to the database.

Base64 encoding increases the storage requirement by 33% over a raw binary format. It also increases the amount of data that must be read from persistent storage, which is still generally the largest bottleneck in computing. It's generally faster to read less bytes and encode them on the fly. However, if your system is CPU bound instead of IO bound, then consider storing in base64. Also, inline images are a bottleneck themselves--you're sending 33% more data over the wire, and doing it serially. Whatever you do, make sure you don't store base64 encoded data as UTF8

vishal pardeshi
  • 344
  • 4
  • 14