filename = demo.jpg
current_date = 14/12/2008
by Year : images/gallery/2008/demo.jpg
by Year/Month : images/gallery/2008/12/demo.jpg
by Year/Month/Day : images/gallery/2008/12/14/demo.jpg
But you could have duplicate filenames, solve this with a db unique id,
prepend all filenames with it:
images path = /images
gallery path = /gallery
filename = demo.jpg
current_date = 14/12/2008
unique_id = 7
images/gallery/2008/12/14/7_demo.jpg
{IMAGES_PATH}/{GALLERY_PATH}/{YEAR}/{MONTH}/{DAY}/{UNIQUE_ID}_{FILENAME}.{FILE_EXTENSION}
image dimensions can be appended to filenames
{IMAGES_PATH}/{GALLERY_PATH}/{YEAR}/{MONTH}/{DAY}/{UNIQUE_ID}_{FILENAME}_{IMAGE_DIMENSIONS}.{FILE_EXTENSION}
Marco Pracucci-2 wrote:
>
> Hi,
>
>> Thanks for the tip about the watermarking class. That will DEF come in
>> handy.
>
> Feedbacks or improvement about the algorithm are appreciated.
>
>> About my original question, I am more interested in your thoughts on
>> how to
>> store more then just a few thousand images. What sort of directory
>> structure
>> algorithm would maximize the number of images I can store on a single
>> server.
>
> The max number of images that you can store on a single server depends
> on the server storage capacity. However, common filesystems decrease
> performances when it increase the number of files stored in the same
> directory. A simple way to solve this problem is creating a multi-
> level directory structure. The number of levels depends on the number
> of files that you have to store.
>
> The basic approch:
> 1) You need a unique file id (for ex. the filename, if it's unique)
> 2) Calculate an hash of the file id
> 3) Use the first hash characters to create the multi-level directory
> path
>
> Example:
> filename = 'demo.jpg'
> MD5 hash = '58742c8b92bbb73be0789340fc0ade77'
> 2-levels directory = /5/8/demo.jpg
>
> Marco Pracucci
>
>> I am setting up a seperate cdn domain for a web project with a
>> subdomain(s)
>> to store uploaded images, and I expect to be storing ALOT of images.
>
>
>
--
View this message in context: http://www.nabble.com/Image-resizing-performance-question-tp20993012p21004116.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论