Is That Possible To Find Width And Height Of An Image Using Php Dom?
I scrap a webpage content using curl. And create DOM using that html content. I need to check size of the images that contained in that html. Is that possible to width and height o
Solution 1:
As you are saying img tag is not containing height & width. You can look at getimagesize PHP function. You need to pass image url you getting from scrapping to getimagesize function.
Ex:
<?php
$size = getimagesize("http://static.php.net/www.php.net/images/php.gif");
print_r($size);
?>
OUTPUT is array
Array
(
[0] => 120
[1] => 67
[2] => 1
[3] => width="120" height="67"
[bits] => 7
[channels] => 3
[mime] => image/gif
)
Hope this help.
Post a Comment for "Is That Possible To Find Width And Height Of An Image Using Php Dom?"