保存图像:文件还是blob? [英] Saving images: files or blobs?

查看:183
本文介绍了保存图像:文件还是blob?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您保存图像(假设您有很多图像)然后作为blob存储在您的数据库或文件?为什么?

When you save your images (supose you have lots of them) do you store then as blobs in your Database, or as files? Why?

重复:在DB中存储图片 - 是或否?

Duplicate of: Storing Images in DB - Yea or Nay?

推荐答案

将它们存储为文件,并将路径存储在数据库中。对我来说,这是一个更容易和更自然的方法,将它们推入数据库作为blob。

I usually go with storing them as files, and store the path in the database. To me, it's a much easier and more natural approach than pushing them into the database as blobs.

一个参数将它们存储在数据库中:更容易做完全备份,但这取决于你的需要。如果您需要能够轻松地获取数据库的完整快照(包括图像),那么将它们作为blob存储在数据库中可能是一种方法。否则,您必须将数据库备份与文件备份配对,并以某种方式尝试关联这两者,因此,如果您必须执行还原,则知道要还原哪对。

One argument for storing them in the database: much easier to do full backups, but that depends on your needs. If you need to be able to easily take full snapshots of your database (including the images), then storing them as blobs in the database is probably the way to go. Otherwise you have to pair your database backup with a file backup, and somehow try to associate the two, so that if you have to do a restore, you know which pair to restore.

这篇关于保存图像:文件还是blob?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆