I'll be honest, I think this is Ruby-centric enough because it really
comes down to basic looping and Erb, so I'll take a stab at it!

<html>
  <body>
    <h1><%= @gallery.name -%></h1>
    <table>
      <% ((@gallery.length / 4) + (((@gallery.length % 4) > 0) ? 1 :
0)).downto(1) do %>
        <tr>
          <% 4.downto(1) do %>
            <td><img src='<%= @gallery.shift -%>'></td>
          <% end %>
        </tr>
      <% end %>
    </table>
  </body>
</html>

That basically figures out how many rows (based on the length divided
by 4, plus 1 if there were any leftovers) and then loops through them.
Then, for each row, we loop four times and for each iteration, we
shift off the front element to go from beginning to end (instead of
pop, which will pull if off the end).

I like this solution a bit better because it uses a very heirarchical
structure much like the way the data will be. Plus, I don't have to
embed any HTML into Erb!

Hope this helps,

M.T.