0

I call api A to receive an image, and server will response : Case 1 : Image encode base64 (Is it good or not? I scare that encode base64 will make api size too big) Case 2 : Url encode base64 of an image Which one is the best option? For case 2, should we encode base64 url before response to client? Thank you.

Khoa Tran
  • 528
  • 6
  • 18

1 Answers1

1

There typically is no need to encode the image, as you can just pass the raw data from client to server. The encoding algorithmns you have specified will take not only extra memory, but will also take more processing power to reverse the encoding on the client side, and they provide no advantages. The only time in which encoding an image makes sense is if you are storing that image in a database, but if you were doing that, you should actually save the image to a localpath on the server, and store the path to the file in the database.

Please see Is it a good practice to send images in base64 string from android to PHP?

Community
  • 1
  • 1
Ninja_Coder
  • 264
  • 1
  • 9