Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-----------------------------*/
- // retreives image from the post
- function getImage($num) {
- global $more;
- $more = 1;
- $content = get_the_content();
- $count = substr_count($content, '<img');
- $start = 0;
- for($i=1;$i<=$count;$i++) {
- $imgBeg = strpos($content, '<img', $start);
- $post = substr($content, $imgBeg);
- $imgEnd = strpos($post, '>');
- $postOutput = substr($post, 0, $imgEnd+1);
- $image[$i] = $postOutput;
- $start=$imgEnd+1;
- $cleanF = strpos($image[$num],'src="')+5;
- $cleanB = strpos($image[$num],'"',$cleanF)-$cleanF;
- $imgThumb = substr($image[$num],$cleanF,$cleanB);
- }
- if(stristr($image[$num],'<img')) { echo $imgThumb; }
- $more = 0;
- }
- //retreive image ends
Advertisement
Add Comment
Please, Sign In to add comment