Storing image as base64string (varchar(max)) or varbinary

后端 未结 1 698
时光说笑
时光说笑 2021-01-21 23:41

What are the pro\'s and con\'s of each?

My requirements are:

  1. I want to be able to encrypt the image
  2. Easily accessible on a mobile device through
1条回答
  •  有刺的猬
    2021-01-22 00:03

    Base64 only uses 6 out of 8 bits in a byte. It dates back to the time when emails were transmitted over lines that were not 7 bits safe.

    Back then, you'd store the image as a binary blob, because that required 33% less storage space. Then you'd convert it on the fly when a client requests a base64 encoded string. Conversion to base64 is very cheap.

    That still makes sense today-- store it as a binary, transmit it like whatever the client requests.

    0 讨论(0)
提交回复
热议问题