mysql 文件系统,存储图像 - 与MySQL的文件系统

I have an android application that allows users to upload images to their account. Im storing the images as longblob files in a mysql db and pulling them from that but I have read on here and other places that its more efficient to store your images in a file system. I know it will work for my alpha to show but its already sucking up space in the db.

Ive seen plenty of people on here and other places mentioning file systems over using a db however....no one makes any references to specific file system software or set ups. Ideally I need a system that would allow for the fastest retrieval of images from it and it has to work with a query from php.

Any tips on the matter would be awesome :)

解决方案

You could store the images on the file system, and use the database to keep a file-pointer, which is simply the path to the location of the image on your system. Then, use a query to fetch the location, and use that as you would for any image.

This thread on DaniWeb shows how uploads could be handled:

Also, use relative paths in case you wish to move the location of the images in the future, as mentioned in the chosen answer here:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值