开发者

How to get size of an image in PHP?

开发者 https://www.devze.com 2022-12-12 00:31 出处:网络
I want to know how many Kb,Mb an 开发者_如何学JAVAimage is by PHPUse the filesize function: $size = filesize(\'image.jpg\'); // Returns size in bytes

I want to know how many Kb,Mb an 开发者_如何学JAVAimage is by PHP


Use the filesize function:

$size = filesize('image.jpg'); // Returns size in bytes

To find out the size in Kilobytes or Megabytes:

$size_in_kb = round($size / 1024, 2);
$size_in_mb = round($size / (1024 * 1024), 2);
0

精彩评论

暂无评论...
验证码 换一张
取 消