PHPQuery-获取图像宽度和高度

PHPQuery-获取图像宽度和高度,php,phpquery,Php,Phpquery,我正在使用PHPQuery分析一个页面 在某个时候,我使用以下方法获得了页面上的所有图像: $url = "http://mywebsite.com"; $all = phpQuery::newDocumentFileHTML($url, $charset = 'utf-8'); // list of all images $imgsrc = $all->find('img'); 现在我正在与这个列表交互 foreach ($imgsrc as $img) { $width

我正在使用PHPQuery分析一个页面

在某个时候,我使用以下方法获得了页面上的所有图像:

$url = "http://mywebsite.com";
$all = phpQuery::newDocumentFileHTML($url, $charset = 'utf-8');

// list of all images
$imgsrc = $all->find('img'); 
现在我正在与这个列表交互

foreach ($imgsrc as $img) {

   $width  = need magic command to extract image width
   $height = need magic command to extract image height

}
问题是这个。img属性没有
宽度
高度
属性,但其类具有

图像标记如下所示:

<img src="img1.png" class="alfa">
我现在如何获得该类的宽度/高度

list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");
获取图像的高度和宽度

list($width, $height, $type, $attr) = getimagesize("img/flag.jpg");