<?
# copy pictures from DB to FileSystem ###########################################################
################################################################################
### !!! EDIT THIS FILE TO YOUR NEEDS - AFTER SUCCESSFULL RUN - DELETE IT !!! ###
################################################################################
$filepath="/home/httpd/vhosts/xxx-banner.com/httpdocs/uploads"; // set FULL Path to your pictures dir
# Include Configs & Variables
#################################################################################################
require ("config.php");
mysql_connect($server, $db_user, $db_pass) or die ("Database Connect Error");
$result = mysql_db_query($database, "SELECT * FROM site") or die(mysql_error());
while ($db=mysql_fetch_array($result)) {
$query = mysql_db_query($database, "SELECT * FROM site WHERE st_id='$db[st_id]'") or die(mysql_error());
$data = @MYSQL_RESULT($query,0,"st_banner");
$fd = fopen ("$filepath/temp.tmp", "w");
fwrite ($fd, $data);
fclose ($fd);
$temp=GetImageSize("$filepath/temp.tmp");
unlink("$filepath/temp.tmp");
$type = $temp[2];
if ($type=="1") {$filename = "$filepath/$db[st_id].gif";}
else {$filename = "$filepath/$db[st_id].jpg";}
$fd = fopen ($filename, "w");
fwrite ($fd, $data);
fclose ($fd);
echo "Picture: $filename converted to file <br>\n";
}
mysql_close();
# End
#################################################################################################
?>