Re: scalable web gallery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<snip>
Another solution that is better if you are not willing to categorize
the images is to divide them by date. You may include a date or
date-time field in the database that describes the creation date of
the image (or the upload date if you like) and divide the images into
directories per month or per year or even both. Like making a
directory 2008 and add inside sub-directories like 01,02,03... or
Jan,Feb,Mar etc. Now when you query the database you may find from the
creation date the directory that sores the image and everything is in
order. For e.g.

If the date you got from the database is 2008-01-23 and the image name
is image01.jpg then the path would be:

<?php

$date = '2008-01-23';
$fname = 'image01.jpg';
list($year,$month,$day) = split('-',$date);
$file_dir = '/data/images';
$path = $file_dir."/".$year."/".$month."/".$fname;

print $path;
?>
</snip>
wow!.. this is a good idea. i really never think of this idea. i think
i want to divide the image
in a folder separated by year. thanks...

i am also wondering if there is another approach on organizing the photos.
what i heard from friends, image gallery like flickr using tag to
organize the photos.
anyone have comment on tag vs album?

On 7/10/08, Per Jessen <per@xxxxxxxxxxxx> wrote:
> paragasu wrote:
>
>> i am planning to create a web photo gallery. i know there is a lot
>> available out there, but i really want to create my own. the problem
>> is not about creating  the photo gallery.
>> i want it to be scalable.
>
> The first question is - how scalable?  How many photos and how many
> users?
>
>> the plan is saving the image metadata in the database and keep the
>> original files in a folder. while it work perfectly, i afraid how many
>> files 1 directory can keep.
>
> Easily more than 100K.  Depending on your filesystem, directory access
> might slow down the bigger it gets.
>
>> in 1 year, there going to be more than 1000 photo uploaded or more.
>> sure it bring problem to maintain thus files.
>
> No, 1000 photos in a single directory will not be a problem at all.
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux