4images Forum & Community
4images Help / Hilfe => Bug Fixes & Patches => Topic started by: V@no on March 14, 2005, 02:38:07 AM
-
When media directory size is over 2 gigabytes it shows as negative ( -2.0 GB )
This is not a bug in 4images itself, but its limitation of intval() (http://php.net/manual/en/function.intval.php) function which can only handle numbers between -2147483648 and 2147483647
As of now, the only sollution I know is dont use that function on numbers larger then 2147483647
Open includes/functions.php
Find: $file_size = intval($file_size);
Replace with:/*
FIX NEGATIVE NUMBERS
ORIGINAL BLOCK:
$file_size = intval($file_size);
*/
/*
FIX NEGATIVE NUMBERS
START REPLACE
*/
if ($file_size < 2147483648)
{
$file_size = intval($file_size);
}
/*
FIX NEGATIVE NUMBERS
END REPLACE
*/
-
For PHP versions 4 through 4.2.0, if you replace:
$file_size = intval($file_size);
with:
$file_size = floatval($file_size);
it will give you the correct size.
I have not tested with all versions of PHP but you could also replace:
$file_size = intval($file_size);
with a float typecast:
$file_size = (float)($file_size);
and get the correct result.
I have tested both methods and they both return the proper size.
-
For PHP versions 4 through 4.2.0, if you replace:
$file_size = intval($file_size);
with:
$file_size = floatval($file_size);
it will give you the correct size.
Chicago Show (http://chicago.nyctourist.com/chicago-entertainment.php)
I have not tested with all versions of PHP but you could also replace:
$file_size = intval($file_size);
with a float typecast:
$file_size = (float)($file_size);
and get the correct result.
I have tested both methods and they both return the proper size.
Excellent and thank you for all of your effort!