Skip to content

Commit dd6f4f9

Browse files
WIP: HumanReadableSize
1 parent e77ba26 commit dd6f4f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Eloquent/Media.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ public function download(): ?string
4040
->download();
4141
}
4242

43-
public function size($precision = 2): ?string
43+
public function humanReadableSize($precision = 2): ?string
4444
{
45-
if ($this->size > 0) {
45+
if ($this->size < 0) {
46+
return null;
47+
}
48+
49+
if ($this->size >= 0) {
4650
$size = (int) $this->size;
4751
$base = log($size) / log(1024);
4852
$suffixes = array(' bytes', ' KB', ' MB', ' GB', ' TB');

0 commit comments

Comments
 (0)