I have a few questions about database storage and retrieval of images. I have an activity that prompts the user to either take a picture using the camera or selecting an existing from the gallery. When a picture has been taken/selected, it is shown in the activity and should be saved in a sqlite database (I use my own content provider).
我有几个关于数据库存储和图像检索的问题。我有一项活动,提示用户使用相机拍照或从图库中选择现有照片。拍摄/选择照片时,它会显示在活动中,并应保存在sqlite数据库中(我使用自己的内容提供程序)。
-
Should I store the images as a blob or store them seperately and then only store the URI pointing to the requested image?
我应该将图像存储为blob还是单独存储它们然后只存储指向所请求图像的URI?
-
How do I show the image and save it?
如何显示图像并保存?
1 个解决方案
#1
0
It really depends on the size of your images.
这实际上取决于图像的大小。
Saving the images to disk and databasing uri's is the is the only sensible suggestion for photographs, however if you are only storing small thumbnails (like avatars), these could be safely stored as blobs without too great a performance hit.
保存图像到磁盘和数据库uri是对照片唯一明智的建议,但是如果你只存储小缩略图(如化身),这些可以安全地存储为blob而不会有太大的性能损失。
As your application description suggests that you are taking photographs, you should use uri's.
由于您的应用程序描述表明您正在拍照,您应该使用uri。
#1
0
It really depends on the size of your images.
这实际上取决于图像的大小。
Saving the images to disk and databasing uri's is the is the only sensible suggestion for photographs, however if you are only storing small thumbnails (like avatars), these could be safely stored as blobs without too great a performance hit.
保存图像到磁盘和数据库uri是对照片唯一明智的建议,但是如果你只存储小缩略图(如化身),这些可以安全地存储为blob而不会有太大的性能损失。
As your application description suggests that you are taking photographs, you should use uri's.
由于您的应用程序描述表明您正在拍照,您应该使用uri。