Link to home
Start Free TrialLog in
Avatar of prady_21
prady_21

asked on

saving images so that they are easily accessible

Hello guys

I will be getting some 1000's of images from couple  of servers of ours and storing it in a single server.
I want to store it in such way that they should be easily accessible. ( later i want to retrieve the images and display it )

www.somewhere.com/sm/logo.gif
www.somewhere.com/sm/image.gif
www.somewhere.com/sm/what.gif
www.elsewhere.com/dontknow/logo.gif
www.elsewhere.com/dontknow/image.gif
www.godknowswhere.com/i/logo.gif

images can have same names, and there can be n no of images from the same site.
Will change some properties of images and so will be using threads (dont know if this matters).

any thoughts and ideas welcome

any doubts do ask me
Avatar of yuzh
yuzh

Is this a programmming question? I think it is a webserver setup question !

If you want to put all the images files, in the same box, and they display
the way you wanted.

you need to setup virtual servers:
www.somewhere.com
www.elsewhere.com
www.godknowswhere.com

all of them are pointing to the same IP, they could have different document root
dir (DocumentRoot), they should be definde in your webserver config file (eg,
for apache, httpd.conf)
eg.

<VirtualHost 123.1.10.5>
    ServerAdmin root@localhost
    DocumentRoot /www/soemwhere
    ServerName www.somewhere.com
    .........
</VirtualHost>
   
    for www.somewhere.com/sm/logo.gif, you need to put it in "sm" dir
under the server root dir, in this case is:
     /www/soemwhere/sm/logo.gif

   ......
   etc, etc, etc.

   IS THIS WHAT YOU WANT TO DO?
 

     
Avatar of prady_21

ASKER

well i am sorry, i think i havent made myself clear,

as i told i will be copying a lot of images

i just wanted a directory structure to store these images (sorry it is not related to programming, but had no idea where to post this question)

i want to store these images in an order so that it can be retrieved easily. i.e if possible without creating big files which contains a list of images and the directory where it is stored.

the problem is there can be many images with the same name as i have told before, so i cant store all the images under the same directory, and i am not supposed to change the name of the images
m(0_0)m


if i create a file of this type --

www.somewhere.com/sm/logo.gif     dir1/logo.gif
www.elsewhere.com/dontknow/logo.gif  dir2/logo.gif    assuming i come until this point,
 
it will still take a long time to search through a file this big (for ex say with some 100000000 lines) for every request to get the directory where the image is placed and then display the image


if it is still vague, i am sorry, i will try to explain better next time u have a doubt

It depands on how many sites you have, if you have less than 1000 dirs, it should be
a problem for searching a text file, eg the format: (dir map)

www.somewhere.com      dir1
www.elsewhere.com        dir2

www.somewhere.com/sm/logo.gif  -> dir1/sm/logo.gif  

it doesn't take long for computer to locate the file.

IF you have millions of sites, then you better use database, to maintain the file
index, (eg mysql is free). to reduce the serach time.


>the problem is there can be many images with the same name as i have told before, so i cant store all the images
>under the same directory, and i am not supposed to change the name of the images

so given an image name, logo.gif, how do you know which among all logo.gifs you want ? Or would you like to retieve all of them ?
at first I thought you wanted a caching mechanisim for your images, not it seems that what you want is a way to catalog all images for easy retrieval, and have someone "audit" images, but have a way to search through this images if they want to get a particular one....

but a little more detail is needed

>>so given an image name, logo.gif, how do you know which among all logo.gifs you want ? Or would >>you like to retieve all of them ?

basically i was thinking of creating a program which when given input such as  www.somewhere.com/sm/logo.gif, i will get the new location where the image is stored --
ex-- www.myserver.com/dir1/logo.gif
and so on--


g0rath- you are right, i just want to search through the images to get a particular one and hopefully fast

well you could use a program such as "wget" to mirror or get a local copy of an entire web directory.

from there you can write a script to enter them into a database for fast retrieval or just use the file system for quick responses such as using find.

find will bog down after time when you get alot of images.

Another way would be to use something like PHP to spider a set of websites, entering all the images that it finds into a table as BLOB type, and giving an indexed key to each image. Then you could build yourself a web front end to take care of your business. You would probably also want to keep an md5sum of each file so that you could easily find duplicate images.

The database should contain the image, the md5sum, and the original URL as records, and from there depending on where you go you can build your table structure around that.
I think catalogue is a good idea ...
you can store pairs

original location    current location

use grep to locate current location ... I dont think a million or so entries would take too long ...

alternatively, you sort the catalogue by original location and use binary search to locate the current location ... that way a file with 2^20 entries can be searched in 20 comparisons !!!
SOLUTION
Avatar of g0rath
g0rath

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am not sure how to implement the Red-Blact Trees method in this case, and as for doing binary search, i had thought about it previously but sorting cannot be done, so i had to drop the idea. :(

Will it make any difference, even if we could change the name of the image file?????

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i finally used the berkeley DB :)