webent Posted June 22, 2008 Share Posted June 22, 2008 Hi, I was wondering if it is possible to have images located in a place on a server where any domain can call them up via secure site? For example, say you have 125,000 images, you have 200 plus domains, instead of copying all those images to each and every domain... Lots of disk space... have them in like /home/images/ and perhaps like a function that does some type of grabbing the image and creating a virtual secure link of it... ? A function that somehow transforms "/home/images/image.jpg" into "https://www.theirdomain.com/images/image.jpg" Quote Link to comment Share on other sites More sharing options...
Stooney Posted June 22, 2008 Share Posted June 22, 2008 Why just assign /home/images/ it's own domain or subdomain? So https://www.theirdomain.com will go to /home/html and https://images.theirdomain.com will point to /home/images I could be completely wrong as I don't know much about https, but based on my knowledge that would be my first try. Quote Link to comment Share on other sites More sharing options...
webent Posted June 22, 2008 Author Share Posted June 22, 2008 The problem with that is that when you call images from outside your domain, you get that insecure/secure warning in your browser... Quote Link to comment Share on other sites More sharing options...
webent Posted June 22, 2008 Author Share Posted June 22, 2008 What about inserting all of those images into a mysql db as blobs, then they could be called from any domain on that server? Or would that be too much of a resource hog? Quote Link to comment Share on other sites More sharing options...
webent Posted June 22, 2008 Author Share Posted June 22, 2008 I found a very comprehensible tutorial on correctly storing large amounts of binary data in blobs, utilizing two tables and splitting the binary data... Here's where I found it, http://www.dreamwerx.net/phpforum/?id=1 ... I just need help with one part of it... I can't figure out why on the calling page, the code wants to download the picture instead of showing it... Please help... Here's the calling page code... <? // Download script.. streams data from a mysql database, thru the webserver to a client browser if (isset($_GET["id"])) { $Storage_IP = "localhost"; $Storage_Port = 3306; $Storage_User = ""; $Storage_Passwd = ""; $Storage_DB = ""; $connectto = $Storage_IP . ":" . $Storage_Port; if (!$linkid = @mysql_connect($connectto, $Storage_User, $Storage_Passwd)) { die("Unable to connect to storage server!"); } if (!mysql_select_db($Storage_DB, $linkid)) { die("Unable to connect to storage database!"); } $nodelist = array(); // Pull file meta-data $SQL = "select * from file where id = " . $_GET["id"]; if (!$RES = mysql_query($SQL, $linkid)) { die("Failure to retrive file metadata"); } if (mysql_num_rows($RES) != 1) { die("Not a valid file id!"); } $FileObj = mysql_fetch_object($RES); // Pull the list of file inodes $SQL = "SELECT id FROM filedata WHERE masterid = " . $_GET["id"] . " order by id"; if (!$RES = mysql_query($SQL, $linkid)) { die("Failure to retrive list of file inodes"); } while ($CUR = mysql_fetch_object($RES)) { $nodelist[] = $CUR->id; } // Send down the header to the client Header ( "Content-Type: $FileObj->datatype" ); Header ( "Content-Length: " . $FileObj->size ); Header ( "Content-Disposition: attachment; filename=$FileObj->name" ); // Loop thru and stream the nodes 1 by 1 for ($Z = 0 ; $Z < count($nodelist) ; $Z++) { $SQL = "select filedata from filedata where id = " . $nodelist[$Z]; if (!$RESX = mysql_query($SQL, $linkid)) { die("Failure to retrive file node data"); } $DataObj = mysql_fetch_object($RESX); echo $DataObj->filedata; } } ?> Quote Link to comment Share on other sites More sharing options...
webent Posted June 22, 2008 Author Share Posted June 22, 2008 Ok, figured out why it was downloading and not showing the images... Header ( "Content-Disposition: attachment; filename=$FileObj->name" ); So now, it's just back to the question on how you all feel about 250,000 images being inserted as blobs and being called from 200 plus domains? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.