如何从数据库中保存/显示图像
您好 -
我正在寻找一些关于如何将jpeg,png等保存到我的数据库的文章。我还希望能够在将图像保存到数据库之前预览图像。此外,我希望能够显示已保存到数据库的图像或其他图像。使用javascript,jquery,ajax和sql数据库。
这是一篇文章,但没有预览其他文章提到画布元素。
如何使用C#ASP.Net jQuery在数据库中存储和检索图像Ashish&#039的博客 [ ^ ]
我想知道是否有人知道其他文章
谢谢
Hello -
I'm looking for some articles on how to save and image jpeg, png etc to my database. I'd also like to have the ability to preview the image before saving it to the database. Additionally I'd like to be able to then display that image or other images that have been saved to the database. Using javascript,jquery, ajax and sql database.
Here is one article but doesnt have the preview other articles mention the canvas element.
How to store and retrieve Image in Database using C# ASP.Net jQuery | Ashish's Blog[^]
I was wondering if anybody knew of another articles
Thanks
使用ASP.NET(或使用数据库的其他服务器端技术),更好的解决方案只存储数据库中的文件名。您可以将图像文件本身存储在站点主机的文件系统中,并为文件提供一些唯一的名称。数据库可以存储简单文件名,或者,如果在多个子目录中的文件集中观察到唯一性,则可以存储一些相对路径名。这种模式比将图像(blob)存储在数据库中更有效。
如果由于一个或另一个原因,你仍然想要存储图像,而不是文件,你可以找到很多信息和代码示例。一次又一次地回答这个问题很难回答:搜索 - CodeProject [ ^ ]。-SA
With ASP.NET (or other server-side technology using your database), better solution would be storing only the file names in the database. You can store the image files themselves in the file system of your site's host and give your files some unique names. The database can store simple file names, or, if the uniqueness is observed in the set of files in more than one sub-directory, some relative path names. This schema will be more efficient than storing the images (blobs) in the database.
If, by one or another reason, you still want to store images, not files, you can find a lot of information and code sample. It would be bad to answer again and again the question answered so many times: Search — CodeProject[^].—SA