I have a php code that will extract and retrieve all the images in a website. How do I modify the code so that the dimensions(width and height) of the images are shown as well?
This is the php coding:
<?php
$page_title = "MiniCrawler";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><?php print($page_title) ?></title>
</head>
<body>
<?php
ini_set('display errors',1);
error_reporting(E_ALL|E_STRICT);
Include simple_html_dom.php.
include_once ('simple_html_dom.php');
// Add the url of the site you want to scrape.
$target_url = "http://www.alibaba.com/";
// Let simple_html_dom do its magic:
$html = new simple_html_dom();
$html->load_file($target_url);
// Loop through the page and find everything in the HTML that begins with 'img'
foreach($html->find('img') as $link){
echo $link->src."<br />";
echo '<img src ="'. $link->src.'"><br />';
}
?>
</body>
</html>
Thanks