[SOLVED] Gallery module - 5 images per row

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
jwaiv
Forum Members
Forum Members
Posts: 10
Joined: Mon May 16, 2011 1:21 pm

[SOLVED] Gallery module - 5 images per row

Post by jwaiv »

Hello,

I'm using the Gallery module with the the Fancybox template and i'm having problems getting it to display images they way I want it to.

First of all I would like it to show 5 images per row, at the moment it just puts on as many as will fit. I would also like these rows to be centered on a per row basis.

I've tried a lot of things today to get this to work but i'm having zero luck.

Can anyone help?

Thanks
John
Last edited by jwaiv on Fri May 20, 2011 10:11 am, edited 1 time in total.
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Gallery module - images per row

Post by Jos »

Just add a width of the <div class="gallery"> to the stylesheet in which will fit 5 images.
To center that div, a margin: 0 auto; should do the trick
jwaiv
Forum Members
Forum Members
Posts: 10
Joined: Mon May 16, 2011 1:21 pm

Re: Gallery module - images per row

Post by jwaiv »

Thanks for that, I did not quite work as I thought it would. I found someone on the forum who was doing a 3*3 grid and altered it a little to match what I wanted it to do.

Code: Select all

<div class="gallery">
<div align="center">
<table>
     <tr>
{foreach from=$images item=image name=foo}
        <td>
        {if $image->isdir}
                  <a href="{$image->file}" title="{$image->title}"><img src="{$image->thumb}" alt="{$image->title}" /></a><br />
                  {$image->title} 
        {else}
                    <a class="group" href="{$image->file}" title="{$image->title}" rel="gallery"><img src="{$image->thumb}" alt="{$image->title}" /></a>
        {/if}
        </td>
  {if $smarty.foreach.foo.index % 5 == 4}
     </table></tr></div><div align="center"><table><tr>
  {/if}
{/foreach}
      </tr>
</table>
</div>
The above is what I used, puts 5 images on each row and centres each set of rows individually (so it does not look as odd when theres a final row with under 5 images).

Thanks
Post Reply

Return to “Modules/Add-Ons”