Greetings,
I would use HTML::Template to set up a table for image display, 5 per row, as many rows as needed. Something like
<table border="0" cellpadding="4" cellspacing="1" bgcolor="#000000"> <TMPL_LOOP name="rowloop"> <tr bgcolor="#ffffff"> <td valign="top"> <TMPL_IF name="img1src"> <img src="/cgi-bin/thumbnail.pl?img=<TMPL_VAR name="img1src">"> </TMPL_IF> </td> <td valign="top"> <TMPL_IF name="img2src"> <img src="/cgi-bin/thumbnail.pl?img=<TMPL_VAR name="img2src">"> </TMPL_IF> </td> <td valign="top"> <TMPL_IF name="img3src"> <img src="/cgi-bin/thumbnail.pl?img=<TMPL_VAR name="img3src">"> </TMPL_IF> </td> <td valign="top"> <TMPL_IF name="img4src"> <img src="/cgi-bin/thumbnail.pl?img=<TMPL_VAR name="img4src">"> </TMPL_IF> </td> <td valign="top"> <TMPL_IF name="img5src"> <img src="/cgi-bin/thumbnail.pl?img=<TMPL_VAR name="img5src">"> </TMPL_IF> </td> </tr> </TMPL_LOOP> </table>
As for resizing you could create a script that reads in a single image and outputs the resized version, like a thumbnail, You will need GD or Image::Magic for this. Then with your gallery script fill the HTML::Template with image tags that call the thumbnail script i.e. <image src="/cgi-bin/thumbnail.pl?img=foobar.jpg" /> That way you don't have to slurp the entire directory of images in, just their names.

Update Fixed Template formatting for readability

-InjunJoel

"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo

In reply to Re: reading all images in a directory by injunjoel
in thread reading all images in a directory by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.