4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 09, 2010, 03:13:52 PM

Login with username, password and session length
Search:     Advanced search
4images is now on facebook. Click here and become a fan!
Translate this page with google
=>
 Translate this page with Google =>
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Help / Hilfe
| |-+  Bug Fixes & Patches
| | |-+  [1.7 / 1.7.1] Media directory size shows negative value (ACP)
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: [1.7 / 1.7.1] Media directory size shows negative value (ACP)  (Read 13951 times)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17302

Thank You
-Given: 27
-Receive: 250

mmm PHP...


View Profile WWW
« 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() 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:
1
  $file_size = intval($file_size);

Replace with:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
  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
*/
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
bxbx
Pre-Newbie

Offline Offline

Posts: 4

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #1 on: March 03, 2006, 05:38:28 PM »

For PHP versions 4 through 4.2.0, if you replace:

1
$file_size = intval($file_size);

with:

1
$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:

1
$file_size = intval($file_size);

with a float typecast:

1
$file_size = (float)($file_size);

and get the correct result.

I have tested both methods and they both return the proper size.
Logged
jongerard
Pre-Newbie

Offline Offline

Posts: 1

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: April 16, 2010, 04:26:38 AM »

For PHP versions 4 through 4.2.0, if you replace:
1
$file_size = intval($file_size);
with:
1
$file_size = floatval($file_size);
it will give you the correct size.
Chicago Show
I have not tested with all versions of PHP but you could also replace:
1
$file_size = intval($file_size);
with a float typecast:
1
$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!
« Last Edit: April 17, 2010, 02:25:26 AM by jongerard » Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
piqs.de - Fotocommunity & lizenzfreie Fotos
Page created in 0.348 seconds with 19 queries.