Solved

saving images so that they are easily accessible

Posted on 2003-11-12
12
343 Views
Last Modified: 2010-04-22
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
0
Comment
Question by:prady_21
  • 4
  • 3
  • 3
  • +1
12 Comments
 
LVL 38

Expert Comment

by:yuzh
ID: 9737582
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
 
LVL 3

Author Comment

by:prady_21
ID: 9737733
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
 
LVL 38

Expert Comment

by:yuzh
ID: 9737775
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
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9738796
>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
 
LVL 5

Expert Comment

by:g0rath
ID: 9740294
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
 
LVL 3

Author Comment

by:prady_21
ID: 9744692

>>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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 5

Expert Comment

by:g0rath
ID: 9745351
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
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9745965
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
 
LVL 5

Assisted Solution

by:g0rath
g0rath earned 75 total points
ID: 9747289
heheh...love the binary search....anyone tried AVL or Red-Black Trees?
0
 
LVL 3

Author Comment

by:prady_21
ID: 9761737
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
 
LVL 45

Accepted Solution

by:
sunnycoder earned 75 total points
ID: 9761744
>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
 
LVL 3

Author Comment

by:prady_21
ID: 9792210
i finally used the berkeley DB :)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now