When creating an image gallery in Drupal using CCK/Fields the resulting output is just a string of divs resulting in a single column of images. This tutorial will show you how to use Views and Panels to override the standard node output to display the images of the gallery in a grid.

For this tutorial you will need the following modules installed:
Setting up the view
We will be using Views to create the grid layout and use the arguments/contextual filter to tell views which node we want it to display the images from.
First create the view giving it whatever name you want. Select Content of type Gallery (or whatever your gallery node is) and uncheck the Page option as all we need is the basic View.

Fields
Under fields press Add. Find your field which the images are contained within and add it. Select all the presets you want, under Multiple Field Settings, uncheck the box. This will make every image in the node a new row within our view.

Click Title and remove it.
Pager
Under Pager, select Display all items and keep the offset as 0.
Contextual filters
If you press Preview at this stage you will see a long list of every image within your galleries (if you have already uploaded images).
What we want to do is limit the results to only a single node.
Under the Advanced section of the Views window, click Add next to Contextual Filters.
Select Content: Nid from the list. Select Provide default value and from the drop down select Content ID from URL.

Now in the preview filter box, enter a node ID of one of your galleries. The preview will now show you a list of images in just that node, similar to what you would get on a normal node display.
Format
Under Format click where it says Unformatted and select Grid. Leave all the options as they are unless you would like to change anything, just make sure you leave Grouping field set to - None -.
Now if you press Preview you should see the grid of images.
Save the view.
Overridding the node view
At this stage some people may just prefer to create a block from that view and display that on the node page within one of themes regions. But I am going to show you how to use Panels to override the default node view.
You will need the Page manager and Views content pane modules installed which come as part of Ctools.
Go to Structure > Panels.
Under Manage pages press Enable next to Node template.

Then click Edit.
Select Add variant.
Give it a name and tick the Selection rules box.

On the selection rules screen, under the drop down select Node: type and press Add. From the options check the box next to your gallery node.
On the next screen choose your panels layout that you want. Enter anything you need to put in under Panel settings.
Under Panel content we can chose what blocks/fields/content appear within our panel.
In the region that you would like to place the content in, click the cog at the top left and select Add content.
I want to show the node's description followed by a grid of images. So on the left hand side, select Node. This will then show you all the fields that belong to the node that are available. In my case I will select Field: Body (body) and I will set the Label to Hidden.

Once you have added that (if you want to show the node body that is), click on the same cog and chose Add content again. This time on the left hand side chose Views.
From here select the view that you created. Leave Display set to Master and press Continue you can override the contextual filter here by setting the Content: NID or leave it as it is, it really doesn't make a difference in this case.

Once you are done, save the panel.
The result
Now if you go to one of your gallery nodes, panels will override the standard node view template and use what we just created.

Display Suite
You can also override/add to the node template by using Display Suite but I personally haven't used it.



Comments
Thanks!
THANK YOU SO MUCH!!!
thanks!
Thank you so much, you really helped me very much
maybe also say clearly that you need to enable it also in the end, i was stuck there...
thanks a lot!
Mathieu S.
question
when i finnally applied the panel setting, i couldn't click on the image to let it show in colorbox.. any solution for that?
problem...
How come when i follow your tutorial i can no longer click on my images (in grid) for my colorbox? any solution would be welcome!
Change the image formatter
Change the image formatter from image to colorbox in views.
Field: Body (body)
when i am following your tutorial i come to the point where i am supposed to select "Field: Body (body)" and set it to hidden, but it is not there.
some help please
greetz
double images
i have followed your tutiorial but when finished i have on top the 1 colomn with pictures and beneath it the same pictures in grid view for how it is supposed to be
any idea
thnx in advance
You need to set the Image
You need to set the Image fields to be hidden under "Display" of the content type.
Help needed.
im having problems locating which field my images are located under i have 4 to choose from which are
Content: Photos (field_photos:alt)
Appears in: node:gallery.
Content: Photos (field_photos:delta)
Delta - Appears in: node:gallery.
Content: Photos (field_photos:fid)
Appears in: node:gallery.
Content: Photos (field_photos:title)
Appears in: node:gallery.
which one do i choose to make it work?
If you are getting those
If you are getting those results, you are looking under 'Filters' rather than 'Fields'.
ok figured that bit out now stuck somewhere else
im stuck on the bit where you say to select node:type and press add it does not give me a check box after that it just goes straight back to the same screen where the node:type drop down box is.
I assume you have created the
I assume you have created the Gallery content type. When you click Add next to Node: Type you should get a list of all the content types.
my views and panels not installed properly?
i dont see that next screen is there any way i can do it without using panels? as i keep getting a 403 fobbiden error from the server for the ccs for ctool and views and panels and all the javascript for it?
Go to Reports > Status report
Go to Reports > Status report and see if there are any problems. It sounds as though your files directory isn't fully writeable.
I did everything but it seems as if it wasn't saved
I did everything as mentioned but got no effect. It seems as if the variant wasn't saved because when I go to the panel page, I see No variants. What am I missing?
I followed your tutorial on creating an album gallery. Everything worked perfectly but I am kind of stuck with the panel.
Oh drupal and modules. If I was harding coding this album stuff by myself, I would have completed what I wanted to achieve centuries ago. Anyways, I just want to continue what I have already started.
Did you press Update and
Did you press Update and Save, not just Update?
Appended gallery under basic page
First of all I have to thank you very much, you really helped me.
Everything works perfect. Now I try to do some more stuff.
I try to append existing gallery to normal page below the text. It work through content types well, (adding field_gallery to basic page) but pictures are in column again now. How can I change the view to override the combo page (basic page + gallery node) to make pictures be in grid.
Well, maybe there is some better way to get the result I am looking for, then please kick me someone to the right direction.
Under Display fields for the
Under Display fields for the content type you will need to set it to for the images, then create a view to show a grid of images based on the NID in the path using arguments.
Hello,
Hello,
before I found this tutorial, I Add few custom fields to forum posts. (I have Advanced forum)
That I want is to override forum post node, to show custom fields.
Now I did as you say, Then I do View preview, I can see my post as I want to see it.
But then I do my Panel, after I select all fields I want to see, I can not see anything.
When I open forum post, I can see nothing, mean post is overrided, but panel is empty.
Any clues?
Thanks You very much.
Try selecting the node fields
Try selecting the node fields for the panel rather than a view and see if that helps, if it does then your view isn't set up properly.
thanks a lot
thanks a lot
Awesome !
Thanks, that was an excellent write up !