Get the size of an image in php

<?php

$img = get_headers(“YourimageURL.jpg”, 1);
print_r ($img);

?>
// OUTPUT It returns araay of image detail
Array
(
[0] => HTTP/1.1 200 OK
[Content-Type] => image/jpeg
[Content-Length] => 27781
[Connection] => close
[Cache-Control] => max-age=5184000
[X-XSS-Protection] => 1; mode=block
[X-Content-Type-Options] => nosniff
[X-Nginx-Cache-Status] => HIT
[X-Server-Powered-By] => Engintron
[Pragma] => public
[Vary] => Accept-Encoding
[Accept-Ranges] => bytes
)