hi I'm while using code below to read a directory and display all of the JPEGs from this but because of WordPress pathways i am coming unstuck:

<?php 
    $path = get_bloginfo('template_directory');
    $files = glob("homepageBottomPictures/*.*");
    var_dump($files);
    for ($i=1; $i<count($files); $i++) {
        $num = $files[$i];
        echo '<img src="'.$num.'" alt="random image" class="homepageBtmImg">'."&nbsp;&nbsp;";
    } 
    echo '<div class="clearfix"></div>';
?>

So during my theme directory i've got a folder known as homepageBottomPictures with JPEGs inside them. So what can i actually do? (Right now, there is nothing came back to $files)

You might find this helpful, here's some code I authored to obtain image files of the couple of types having a certain pattern within the filename. You can alter it a little to drag only jpg's associated with a pattern.

function returnimages($dirname, $photo_id) {

        $pattern="(^".$photo_id."[A-Za-z0-9_]*\.jpg$)|(^".$photo_id."[A-Za-z0-9_]*\.png$)|(^".$photo_id."[A-Za-z0-9_]*\.jpeg$)|(^".$photo_id."[A-Za-z0-9_]*\.gif$)"; //valid image extensions
        $files = array();
        $curimage=0;

        if($handle = opendir($dirname)) {
            while(false !== ($file = readdir($handle))){
                if(eregi($pattern, $file)){         //if this file is a matching image
                    $files[$curimage] = $dirname.$file;   //Save it in the array
                    $curimage++;
                }//end if
            }//end while

            closedir($handle);
        }//end if   
return($files);

}//end returnimages 

Use: get_theme_root() . get_template() . '/homepageBottomPictures/*.*' to obtain your directory