Page 2 of 2

Re: How do you filesize of an image from DB?

Posted: Wed Sep 18, 2013 2:11 pm
by Celauran
Something isn't adding up here.

Code: Select all

echo round(35681 / 1024); // 35

Re: How do you filesize of an image from DB?

Posted: Wed Sep 18, 2013 6:00 pm
by Christopher
What did you expect? The result is 34.8447265625 which would round to 35. Did you want floor()?

Re: How do you filesize of an image from DB?

Posted: Wed Sep 18, 2013 8:46 pm
by Celauran
simonmlewis wrote:It's actually 35,681 bytes.
simonmlewis wrote:The script states 32KB
Floor, ceil, round, there's no way it should give 32. Something else is afoot here.

Re: How do you filesize of an image from DB?

Posted: Thu Sep 19, 2013 7:09 am
by simonmlewis
On Windows Explorer: 34.8KB
Using the PHP Script: 32KB. Not rounded: 32894

It's not totally important to be accurate, but odd that isnt' anyway.

Re: How do you filesize of an image from DB?

Posted: Thu Sep 19, 2013 7:37 am
by Celauran
OK, so it is accurate. Good.

Re: How do you filesize of an image from DB?

Posted: Thu Sep 19, 2013 11:13 pm
by Eric!
Here's an example from linux:
[text]-rw------- 1 user user 289059 Sep 19 18:04 photo.jpg[/text]
Bytes are 289059.

But using the build in kB format it's not so correct:
[text]-rw------- 1 user user 283K Sep 19 18:04 photo.jpg[/text]

From php:
[text]filesize=289059
filesize/1024=282.2841796875[/text]

PHP is the exact answer.

Re: How do you filesize of an image from DB?

Posted: Tue Sep 24, 2013 4:24 am
by priyankagound
Try out this one.
You will get the complete reference in the below link.

http://www.phpeasystep.com/phptu/3.html

Hope this helps you.