存储图像 - 与MySQL的文件系统 [英] Storing images - mysql versus file system

查看:178
本文介绍了存储图像 - 与MySQL的文件系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,允许用户上传图片到他们的帐户。林存储图像作为LONGBLOB文件的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.

我见过很多在这里的人与其他地方提的文件系统,但是在使用分贝....没有人让到特定的文件系统软件或设置窗口的任何引用。理想情况下,我需要一个系统,以便从它的图像的最快的检索和它与从PHP查询工作。

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.

该线程DaniWeb显示上传如何处理:

This thread on DaniWeb shows how uploads could be handled:

http://www.daniweb.com/web-development/php/线程/ 162230

此外,使用相对路径如果要移动的未来图像的位置,正如所选择的答案在这里:

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:

<一个href="http://stackoverflow.com/questions/678293/when-storing-images-in-the-file-system-use-relative-paths-or-absolute-paths">When将图像存储在文件系统中,使用相对路径或绝对路径?

这篇关于存储图像 - 与MySQL的文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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