I have a folder full of images, ad im trying to use php to display them, is this right?
<?php
$handle = opendir(dirname(realpath(__FILE__)).'/../images/dolls/'.$row['id']);
while($file = readdir($handle)){
echo '<img src="realpath(__FILE__)).'/../images/dolls/'.$file.'" border="0" />';
}
?>
Did you run it and test if it works?
wordpress is strange, cause I get this
/home/nikel0/public_html/wordpress/wp-content/plugins/exec-php/includes
output by
<?php
echo realpath(dirname(__FILE__));
?>
Rubble
5
I would use glob with relative paths and echo $ file in your while loop to see what it contains. Also does $row[‘id’] contain anything?
Try this and scroll to the bottom for the source;
http://johns-jokes.com/afiles/gif/
ok, so its working,
http://nikelantiquedolls.com/wordpress/?page_id=13
using
<?php
$files = glob("wp-content/themes/nikkistheme/images/dolls/".$id."/*.jpg");
foreach($files as $file){
echo '<img src="'.$file.'" border="0" />';
}
?>
is this ok?