Download Time

I don’t have time to create this mod right now, but here is an example php script for the download time.



```php

function compute($file_size_kb,$modem_speed,$ms,$sv) {
$TotalTime = ($file_size_kb / $sv[$ms[$modem_speed]]);
$TotalHours = floor($TotalTime / 3600);
$TotalHoursMod = ($TotalTime % 3600);
$TotalMin = floor($TotalHoursMod / 60);
$TotalMinMod = ($TotalHoursMod % 60);
$TotalSec = floor($TotalMinMod);
return array("hours"=>$TotalHours,"minutes"=>$TotalMin,"seconds"=>$TotalSec);
}

function makeTable($size) {
$fs = $size;
$file_size = $fs / 1024;
$fse = 0;
$fsa = array(" byte"," Kb"," Mb"," Gb"," Tb");
while($fs >= 1024) {
$fs = $fs / 1024;
$fse++;
}
$fsf = round($fs,2) . $fsa[$fse];

$modem_speeds = array();
$modem_speeds[0] = "9.6 Kb";
$modem_speeds[1] = "14.4 Kb";
$modem_speeds[2] = "28.8 Kb";
$modem_speeds[3] = "56 Kb";
$modem_speeds[4] = "ISDN (64 Kb)";
$modem_speeds[5] = "ISDN (128 Kb)";
$modem_speeds[6] = "T1 (1.54 Mb)";
$modem_speeds[7] = "Cable Modem (10 Mb)";
$modem_speeds[8] = "Cable Modem (27 Mb)";
$modem_speeds[9] = "T3 (45 Mb)";
$modem_speeds[10] = "ATM (155 Mb)";

$speedVar = array("9.6 Kb"=>1.1719,"14.4 Kb"=>1.7578,"28.8 Kb"=>3.5156,"56 Kb"=>6.8359,"ISDN (64 Kb)"=>7.8125,"ISDN (128 Kb)"=>16.6250,"T1 (1.54 Mb)"=>187.9883,"Cable Modem (10 Mb)"=>1220.7031,"Cable Modem (27 Mb)"=>3295.8984,"T3 (45 Mb)"=>5493.1641,"ATM (155 Mb)"=>18920.8984);

$out = "

Download Times for a " . $fsf . " file:

\n";
$out = $out . "\n";
$out = $out . " \n \n \n";
$ni = 0;
for($i=0;$i $download_time = compute($file_size,$i,$modem_speeds,$speedVar);
if(join(":",$download_time) != "0:0:0") {
$dt = array();
if($download_time["hours"] != 0) {
$dt[count($dt)] = $download_time["hours"] . " hours";
}
if($download_time["minutes"] != 0) {
$dt[count($dt)] = $download_time["minutes"] . " minutes";
}
if($download_time["seconds"] != 0) {
$dt[count($dt)] = $download_time["seconds"] . " seconds";
}
$out = $out . " \n \n \n \n \n";
} else {
$ni++;
}
}
if($ni > 0) {
$out = $out . " \n \n \n \n \n";
}
$out = $out . "
Modem Speed Download Time
\n " . $modem_speeds[$i] . "\n \n " . join(", ",$dt) . "\n
\n All Faster Speeds\n \n Instant Download\n
\n";
echo $out;
}

makeTable($_GET["size"]);
?>

```

Ok, I just tried to make the mod, but couldn’t figure out how best to integrate it.

Does anybody know how I would go about integrating this into the download page found by following the [download] link in the order details page?

I’ve got no idea how to implement, but wouldn’t it be cool if you added a tab with the information above where the file size was listed and displayed prior to download?

I think I already have enough tabs. They start going to the next row on smaller resolutions.



Plus if you have the file path you can use:



```php makeTable(filesize($fn)) ```

I did it. Here it is.



It doesn’t have any admin settings yet though.