使用文件组/文件流在 Sql Server 2008 数据库中存储图像
有没有人有过使用文件组和文件流将用户上传的图像存储在 MSSQL 2008 数据库中的经验? 我读了一些文章,似乎说它们是一个好主意,因为您可以获得在磁盘和数据库中存储图像的所有优势。 例如,
我已经为当前的项目实现了这一点,但似乎我做了很多不必要的工作,必须转换字节并将它们写入图像。 (我正在使用 ASP.Net MVC)
还有其他我应该担心的问题吗? 我真的应该自己将这些图像存储在磁盘上吗? 我是否应该考虑其他替代方案,例如 Amazon AWS?
Has anyone had an experience storing user uploaded images in a MSSQL 2008 Database using Filegroups and Filestreams? I read a few articles that seemed to say they are a good idea because you get all the advantages of storing images on disk and in the db. For example
I have implemented this for my current project but it seems like I'm doing a lot of unnecessary work having to convert the bytes and writing them as an image.
(I'm using ASP.Net MVC)
Are there any other gotchas I should be worrying about? Should I really being storing these images on the disk myself instead? Should I look into other alternatives such as Amazon AWS?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我现在已经用 MVC 编写了几个应用程序,它们都需要存储图像,并且我已将它们放入数据库中,因为这样可以更轻松地将图像与记录关联起来,而不是让记录为我提供文件名和位置。
我还做的事情是,如果图像太大,我会缩小图像的大小。 如果较小的文件也能安装到位,那么存储 4 毫克的文件就没有意义。
I've written a couple of apps with MVC now both of which require images stored and I've placed them in a database as that way it was easier to associate images to records rather than have a record giving me the file name and location.
The thing I also do is I reduce the size of the image if it's too big. No point storing a 4mg file if a smaller one will fit in place just as well.
我最终使用了 Azure 博客存储。 它非常适合图像存储!
I ended up using Azure Blog Storage. It works great for image storage!