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:

    $path = get_bloginfo('template_directory');
    $files = glob("homepageBottomPictures/*.*");
    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();

        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
                }//end if
            }//end while

        }//end if   

}//end returnimages 

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