对于〜25万的图像最佳web文件夹结构 [英] Optimum web folder structure for ~250,000 images

查看:190
本文介绍了对于〜25万的图像最佳web文件夹结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将有20万左右图像作为我的网站的一部分。每个图像将被保存3次:全尺寸,缩略图,大缩略图。全尺寸的图像都是围绕以是50 Kb 500KB。

I will have around 200,000 images as part of my website. Each image will be stored 3 times: full size, thumbnail, larger thumbnail. Full size images are around 50Kb to 500Kb.

普通技术:Linux操作系统,Apache,MySQL和PHP上的车辆定位系统

Normal tech: Linux, Apache, MySQL, PHP on a VPS.

什么是存储这些通过浏览器??

What is the optimum way to store these for fast retrieval and display via a browser??

我应该存储在一个文件夹中的一切?
我应该存储在1文件夹的完整大小的图像,在另一个等的thumbails?
我应该在图像存储1000的文件夹,并保持的索引哪个文件夹图像是?

Should I store everything in a single folder? Should I store the full size images in 1 folder, the thumbails in another etc? Should I store the images in folders of 1000, and keep an index to which folder the image is in?

感谢您的任何意见。
阿尔伯特。

Thanks for any advice. Albert.

推荐答案

我会使用一个拆分目录结构,三个或四个层次深,这个想法被拆分的所有文件均匀地分布到多个目录,使维护主要是方便,快速访问。

I'd use a split directory structure, three or four levels deep, the idea being split all the files evenly across many directories, to enable mainly easy maintenance and fast access.

怎么办呢?有各种替代方案

How to do it? There are various alternatives:


  • 拍摄的图像名称的第一个字符

  • 以名称的哈希值的前几个字符

  • 以秒的最后一个数字自1970年以来之日起加入图片

  • 拍摄的图像ID的最后一个字符在一个数据库(如果存在)

让我们假设有IMG8993_full.jpg,IMG8993_thumb.jpg,IMG8993_smallthumb.jpg

Let's suppose we have IMG8993_full.jpg, IMG8993_thumb.jpg, IMG8993_smallthumb.jpg

然后,我们可以有,例如:

Then we could have, for example:

/images/I/M/G/8/IMG8993:
IMG8993_full.jpg
IMG8993_thumb.jpg
IMG8993_smallthumb.jpg

这篇关于对于〜25万的图像最佳web文件夹结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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