Storing a large number of images

后端 未结 12 761
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 09:25

I\'m thinking about developing my own PHP based gallery for storing lots of pictures, maybe in the tens of thousands.

At the database I\'ll point to the url of the i

12条回答
  •  -上瘾入骨i
    2020-12-07 09:34

    I am currently facing this problem, and what Isaac wrote got me interested in the idea. Tho my function differs a little.

    function _getFilePath($id) {
        $id = sprintf("%06d", $id);
        $level = array();
        for($lvl = 3; $lvl >= 1; $lvl--)
            $level[$lvl] = substr($id, (($lvl*2)-2), 2);
        return implode('/', array_reverse($level)).'.jpg';
    }
    

    My images are only in thousands so i only have this up to 999999 limit and so it would split that into 99/99/99.jpg or 43524 into 04/35/24.jpg

提交回复
热议问题