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
LVL 3
prady_21Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yuzhCommented:
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?
 

     
0
prady_21Author Commented:
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

0
yuzhCommented:
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.


0
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

sunnycoderCommented:
>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 ?
0
g0rathCommented:
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
0
prady_21Author Commented:

>>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

0
g0rathCommented:
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.
0
sunnycoderCommented:
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 !!!
0
g0rathCommented:
heheh...love the binary search....anyone tried AVL or Red-Black Trees?
0
prady_21Author Commented:
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?????

0
sunnycoderCommented:
>i had thought about it previously but sorting cannot be done, so i had to drop the idea. :(
why not ? If you cannot sort, the file, you can build an index file separately and use it for searching ...

$]sort filename

as simple as that
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
prady_21Author Commented:
i finally used the berkeley DB :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.