i have a news system ,i want show news abstract in home page with an image thumbnail.
i need to Convert HTML to text , and get all image tag for creating thumbnail.
but i dont know how can i catch all image tag SRC value !
please help me
thx
Moderator: General Moderators
Code: Select all
<img class="a" src="a.jpg" width="10">Code: Select all
<img(.*)src="(.*)">Code: Select all
a.jpg" width="10Code: Select all
<?php
$input=implode('',file('http://www.yahoo.com'));
$count_found=preg_match_all("#<img.*src=[\"\'](.*)(.gif|.jpg|.jpeg|.png|.bmp)[\"\'].*>#i", $input, $matches);
print "$count_found Item Found<br><br>";
for($i=0;$i<=$count_found-1;$i++) {
print "- Item[$i] = {$matches[1][$i]}{$matches[2][$i]}<br>";
}
//print_r($matches);
?>