groups

name language licence
Retrieve and Display Images from a WordPress Post PHP Other
Customizing flickrRSS PHP BSD
Scrobbler PHP BSD
footer PHP GPL 2
Display WordPress Tags Cloud PHP BSD
feedback Other Other
breakout Other Other
my badges PHP BSD

< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 >



language: PHP
licence: Other

Retrieve and Display Images from a WordPress Post

options: view full snippetsend to code collector
function getImage($num) {  
global $more;  
$more = 1;  
$link = get_permalink();  
$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);  
$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;  
$image[$i] = $postOutput;  
$start=$imgEnd+1;  
	
(Continues...)