Hi all, I have a question, how can I make a multi storage (server) image sharing site, that mean I want to make a image sharing site like imageshack, tinypic, photobucket etc. but I don't understand how can they store their images on many different storage server such as at imageshack.us: http://imgcash6.imageshack.us/Himg2...apphiresunsetsizedmu2.jpg&xsize=640&ysize=480, http://imgcash4.imageshack.us/Himg5...&filename=nature10yb8.jpg&xsize=640&ysize=480 at tinypic.com: http://i35.tinypic.com/2q9l5jr.jpg, http://i37.tinypic.com/1ovwp2.jpg at photobucket.com: http://i392.photobucket.com/albums/pp7/magouillelafripouille/Monuments and landscapes/DSCN1984.jpg, http://i2.photobucket.com/albums/y31/friendofallcountries/Landscapes/101_0060.jpg. Any suggestion? Thanks.
It isn't that complicated. You can either use 1 server and have subdomains pointing to it, and set your apache server to make them virtual servers. Or you can have 1 main server with dns server such as bind/named. Then have subdomain pointing to different servers.
Thanks for reply. I understand your suggestion but I don't understand how they(above image hosting sites) choose what static server (like i392.photobucket.com or i2.photobucket.com etc.) is going to store the next uploaded file? Is there any php logic can do that job?
You can store all possible servers in 1 array. $servers = array('s1', 's2', 's3', 'a1', 'a2', 'a3'); PHP: Then use the random function. $next_server = array_rand($servers) . '.photobucket.com'; PHP: Then just reference the file with the server in a database.
but you probably need a script that checks the storage space left on one of them servers. random would only randomly drop it into one of them. A more complex script would check to see how big the file is that you're tyring to upload and then it would check the and drop it into the first storage space that had the available room. that way it wont create the URL path to the file until it knows what storage space it will go into. if and else and when successful.. generate the file path. thats my guess anyway