groups

name language licence
Unique Single template PHP Other
Query Posts PHP Other
Feature post highlighting PHP Other
Retrieve and Display Images from a WordPress Post PHP Other
Attachment display PHP Other
function_exists() PHP Other
Linking Without Using Permalinks PHP Other
Static Page with Mini-Loop PHP Other

< 1 2 3 >



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...)