如何将图像存储在数据库中? [英] How to store images in a database?
问题描述
大家好
我正在一个网站上工作,在那里我会将一些要出售的商品放在网上,这些商品的分类如下:
笔记本电脑|笔记本电脑的形象|笔记本电脑的价格|和详细信息|
打印机| ###################### |价格|和详细信息
复印机|图片|价格|和详细信息
房屋出租|房子的形象|价格|和详细信息
租车|汽车的图像|价格|和详细信息
待售汽车|汽车图片|价格|和详细信息
例如,某商品+该商品的图片,该商品的价格和详细信息,这里的问题是如何插入图片字段?
我正在使用php我的管理员,在MSQL DB上工作.
有谁能够帮助我?在此先感谢您的帮助.最好的问候.
Hi everybody
I am working on a website where I will be putting some items for sells online, and those items will be categorized like this:
Laptops |the Image of the Laptop | Price of the Laptop| and Details|
Printers| #######################| Price | and Details
Photocopier| Images |price| and Details
House to rent| image of the House| Price| and details
Car to hire| images of the Car | price | and Details
Car for Sell| Images of the Car| Price| and Details
For example, an item + the image of that item, the price and details of the item and my issue here is how can I insert the Images field?
I am using php my admin, working on MSQL DB.
Can anybody help me? Thanks in advance for your help. Best Regards.
推荐答案
使用图像时,您在存储数据的方式上有两种选择
1)在数据库本身内部,使用BLOB类型
http://www.wellho.净/解决方案/php-example-php-form-image-upload-store-in-mysql-database-retreive.html [ http://databases.aspfaq.com/database/should-i-store-images-in-the-database-or-the-filesystem.html [
When working with images, you''ve got a couple of choices in how you want to store the data
1) within the database itself, using BLOB type
http://www.wellho.net/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html[^]
2) On the file system, and your database record contains a string that describes the location of the file
e.g
D:\Images\Store\MyFile.jpg
Both methods have advantages \ disadvantages
http://databases.aspfaq.com/database/should-i-store-images-in-the-database-or-the-filesystem.html[^]
这篇关于如何将图像存储在数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!