Use preg_match_all to get the image source from your file.
PHP code:
1 2 3 4 5 6 7 8 | <?php $content='Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. <a href="/"><img alt="" id="logo" src="http:electrofriends.com/favicon.ico"></a>'; $frst_image = preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $content, $matches ); echo $item['image'] = $matches[ 1 ][ 0 ]; ?> |
In the above code variable $content will have the complete source code. Searching the first image using preg_match_all
Output:
1 | http:electrofriends.com/favicon.ico |
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Resources #Terms of Use
Copyright©2012 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com
wow, thank’s for your info. this help me so much