Posts Tagged ‘FileSystem’

31
Oct

how to store user picture in the file system

一个好的文件存储结构不但使用、维护方便,关键是调用方便。
废话少说,直接上菜,厨子开始干活 :)
假设用户上传一个头像,系统为其生成大小不同的三种缩略图,并以用户ID做为目录名称,格式如下:
public/images/users/86799/raecoo.gif (原图)
public/images/users/86799/raecoo-big.gif
public/images/users/86799/raecoo-medium.gif
public/images/users/86799/raecoo-thumb.gif
这样的做法在系统规模较小的时候是没什么问题的,但随着用户数量的增加,这样的存储结构肯定是个隐患。下面介绍一种可容纳大规模存储的解决方案,当然这不一定是最好,也不一定适合你 :)

    About

    Tag Cloud