Image array on a node page
Are you using Drupal 6, or Drupal 7? You should look into the Content Construction Kit module, which would easily allow you to add images to nodes and arrange them. You can set the number of allowed elements to "unlimited" for multiple images.  If you want to be able to place your node images on different parts of the node page, try the Panels module.

Update in answer to first question, below

Why yes; one of the great strengths of Drupal is its ability to let you just plop down some php anywhere in the page you need to put it (but please, don't put your php in the database, if you can help it!).  If all you wanted to do was display images from a folder at a given URL, rendered in your own code, all that you would need would be a menu with 'page callback' set.  If you want to modify a node, though, then you will need to learn about the scary render array.  When you find something in the page that you want to change, the easiest thing to do is to set the #markup element to the exact HTML content you want to display. If you do not want to replace an element, you can use #prefix or #suffix to put HTML before or after the given item.

If you make yourself a theme, you can add a preprocess hook to it (in template.php):

function MYTHEME_preprocess_node(&amp;$variables, $hook) {
  if ($variables['node']-&gt;type == 'page') {
    $variables['content']['field_document_file']['#prefix'] = '&lt;div class="document-wrapper clearfix"&gt;';
    $variables['content']['field_document_file']['#suffix'] = '&lt;/div&gt;';
  }
}


This snippet, simplified from the above-quoted article on render arrays, adds a div around the CCK field called 'field_document_file'.  In your case, you'd probably just want to put some HTML into #suffix after the node body, which I believe is simply $variables['content']['field_document_file']['#suffix'].  To find out what's in a render array, install the devel module, and add a dpm($variables) to your preprocess function.  You're also likely to find the search krumo module to also be highly useful.

As far as actually getting the images onto the page, I trust that you can write your own code with file_scan_directory. Just remember to write secure code when outputting any data that was supplied by the user.

Anyway, that is what you would do; in general, just adding cck image fields and populating those with the images you currently have stored in folders might be easier.  drush entity might help out here. If you have a special need to keep your images in folders, then it's render arrays for you.

An easier option might be to just put your php code in a node-page.tpl.php. I rejected this as an option at first because I felt it would not give you enough flexibility to position your elements in the html output. However, with node-page.tpl.php, you could put your images before or after the node contents, and perhaps adjust the positioning to your satisfaction with css. This would be easier than fixing up the render array.