[英]how to save a image in database
I follow this Instruction and it works. 我遵循此说明 ,它可以工作。
Problem: 问题:
Question: 题:
Unlike some comments suggest, image format doesn't matter. 与某些注释不同,图像格式无关紧要。 You can either save it as BLOB ( byte[]
) or text (converting it to Base64). 您可以将其另存为BLOB( byte[]
)或文本(将其转换为Base64)。
Anyway it's not a good idea to store images in a DB, prefer a file, as argued over here . 无论如何,将图像存储在数据库中而不是文件中并不是一个好主意, 正如本文所讨论的那样 。
i will advice you get the path at which the image is located at in the android device and load up on your application start. 我会建议您获取图像在android设备中的位置,并在应用程序启动时加载。 the case of saving it in a database is not cool. 将其保存在数据库中的情况并不妙。 that is like consuming the user's memory space on the database side and also the device storage which is not cool. 这就像在数据库侧消耗用户的内存空间,而且还消耗不酷的设备存储。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.