我应该将图像存储在数据库还是文件夹中? [英] Should I store my images in the database or folders?

查看:24
本文介绍了我应该将图像存储在数据库还是文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
在数据库中存储图像 - 是还是不是?

目前我网站上的每个公司都有 1 张图片可以添加到他们的个人资料中.我将该图像保存到数据库中....这是他们的公司徽标.

At the moment each Company on my website have 1 picture they can add to their profile. I save that image into the database....its their Company Logo.

现在我想让他们添加更多图片.现在我不知道是否必须将其全部保存在数据库中或保存在文件夹中????

Now i want to allow them to add more pictures. Now i don’t know if i must save it all in the database or save it in folders????

我认为文件夹会更好的原因是因为有很多漂亮的文章,我可以使用带有花哨的银色灯光的功能,但所有这些都只适合保存在文件夹中的图像.

Reason why i think folders will be better is because there are so much nice articles with fancy silver light kinda features that i can use but all of them only cater for images saved in folders.

而且由于我不是那么好,因此我很难更改代码以查看数据库而不是使用文件夹进行图像检索的示例.

And since i am not THAT good its hard for me to change the code to look at the database instead of the examples that uses folders for image retrieval.

我想在我的网站上添加类似的内容(浏览图片).当图像保存在数据库中时,我的任何代码示例如何执行此操作?我正在使用 ASP.NET 和 VB.net.点击这里查看我在说什么

I would like to add something like this to my website (browsing through the images). Any code examples for me on how to do this when images are saved in the database? I am using ASP.NET with VB.net. Click here to view what i am talking about

大家有什么想法吗?

问候艾蒂安

推荐答案

我最近和个人都这样做了;我更喜欢使用目录方法来存储图像,同时将它们的属性保存在数据库中.

I've done it both ways recently and personally; I do prefer using the directory method for storing the images while keeping their properties in a DB.

主要原因:我有客户,我为其建立了网站.在网站上;有一个照片库部分,允许用户上传新照片(可以从公共网站浏览).由于我的客户在上传之前没有考虑优化图像;*.jpg 超过 1mb.我确实实现了更新图像的能力(一旦它被保存到数据库中),但它必须一次完成一个记录.

Main reason: I had client to whom I made a website for. On the Webiste; there was a Photo Gallery section that allowed the user to upload new photos (which could be browsed from the public site). Since my client hasn´t thought on optimizing the images before uploading; the *.jpg was over 1mb. I did implement the ability to update the image (once it was saved to the DB) but it had to be done one record at a time.

如果在将图像存储在目录中时发生这种情况,则可以将文件保存在本地、优化并放回服务器.

If this happens while storing the images in a directory, then the files can be saved locally, optimized and put back onto the server.

这是一个例子

这篇关于我应该将图像存储在数据库还是文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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