上传用户画像的最佳方式是什么

发布于 2024-07-22 06:17:47 字数 93 浏览 4 评论 0原文

存储在数据库或文件系统中?

我需要几种不同的尺寸。 如128*128、96*96、64*64等。

上传用户肖像的最佳方式是什么?

Stored in the database or file system ?

And I need several different sizes. like 128*128, 96*96, 64*64 and so on.

What is the best way to upload user portrait?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悲凉≈ 2024-07-29 06:17:47

由于不知道您的所有限制,我会上传 128x128 图片,然后即时创建所有其他肖像。

我认为您不需要担心将图像存储在数据库中,特别是如果您正在运行 SQLServer 2008(并且您使用新的 FILESTREAM 类型)。

Not knowing all of your constraints, I'd upload the 128x128 picture and then create all the other portraits on the fly.

I don't think you need to worry about storing the images in the DB, specially if you're running SQLServer 2008 (and you use the new FILESTREAM type).

不顾 2024-07-29 06:17:47

最终,这取决于您需要存储的图像数量。

如果将它们存储在文件系统中,则只需将图像的 URL 或位置保留在数据库中即可。 要更改大小,您可以使用组件实时完成,以根据您使用的语言实现更改。 对于.NET ASPjpeg 是一个非常好的选择,但是您可以使用 System.Drawing.Imaging 来操作图像班级。 无需操作数据库文件流或 BLOB 字段。

另一方面,即使您使用的是 SQL Server,但将所有内容都放在同一个位置,将图像存储在数据库中可能会使其太大而无法进行备份或下载,具体取决于记录的数量。 维护速度更快。

将图像存储在文件系统中的问题是清理过程,如果删除一条记录,则需要将文件系统中的图像也删除,以防止保留垃圾。

Definitively it depends of the amount of images you need to store.

If you store them in the file system you just need to keep the URL or location of the image the database. To change the size you can do it in real time using components to achieve the change depending of the language you're using. For .NET ASPjpeg is a very good one, but you can manipulate the image with the System.Drawing.Imaging class. No need to manipulate database filestream or BLOB fields.

In the other hand, storing images in the database can make it too big in order to backup or download depending of the amount of records, even if you are working with SQL server, but you have everything in the same place. Maintenance is faster.

The problem with storing images in the file system is the cleaning procedure, if you delete a record, you need to delete the image in the file system too in order to prevent of keeping garbage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文