[support] image gallery - a simple solution

John Callahan john.callahan at UDel.Edu
Thu Feb 5 18:55:25 UTC 2009


OK.  I feel rather dumb.  To create a simple image gallery like I 
proposed (all photos uploaded in one node then viewed through a 
Lightbox-like display,) you don't need any special gallery type of 
module.  You don't even need views!  You will need: CCK, ImageField, 
Imagecache, and Lightbox2. (but who doesn't already have those anyway!) 
    All you need to do is:

1) configure Imagecache with two presets: one for each image thumbnail 
(e.g., 100x100), and one for slideshow view (e.g., 640x480)

2) create a new content type for these single-node galleries

3) create one CCK/ImageField field and upload images to this node (make 
sure to set the number of items allowed for that image field)

4) in the content type display fields, set the Label to Hidden, and Full 
node to Lightbox2: preset-thumbnail -> preset-slideshow.


That's basically it!  To make the images display horizontally, in a 
grid-like format, change the style of the div container to 
display:inline.  You can put this style inside the page (using Full HTML 
filter), in style.css, or in your node-contenttype.tpl file.  For 
example, if my content type was called "gallerypage" and CCK image field 
"gpimages", then I would use:

.type-gallerypage img{  /* adds frame around image */
border:1px solid #cccccc;
padding:5px;
margin:5px;
}
.field-field-gpimage div{   /* displays images horizontally */
display: inline;
overflow: hidden;
}

There is a post on the D5 imagefield_gallery module that describes 
something very close to this. 

It's also very easy to create a View for a listing of gallery pages, 
with the first image in each gallery as the thumbnail.  Use taxonomy or 
more CCK fields to further categorize your galleries.  (Of course, if 
you wanted images to be part of multiple galleries, I would put one 
image per node and use Views/Lightbox integration. This is the way most 
people suggest and does work very well.) 

- John 

**************************************************
John Callahan
Geospatial Application Developer
Delaware Geological Survey, University of Delaware
227 Academy St, Newark DE 19716-7501
Tel: (302) 831-3584  
Email: john.callahan at udel.edu
http://www.dgs.udel.edu
**************************************************




John Callahan wrote:
> I know there are plenty of options for creating image galleries in 
> drupal. I've used many of them.   Like most people, I'm interested in 
> simple, and like an increasing number of people, I'm not interested in 
> using the image module.  CCK, Views, Imagecache, etc.., is the preferred 
> way to go. 
>
> In the interest of simplicity, I do not want to give my users FTP access 
> to my file system, and I'd rather not require them to create a new node 
> for every image.  So, does anyone have suggestions for the following:
>
>
> 1) users can create the image gallery on one page/node, such as through 
> CCK Image Field or file uploads as attachments
>
> 2) the display of the gallery can be through Lightbox or something similar.
>
>
> Modules like Galleria and Gallerix have potential. They may work with a 
> decent amount of CSS work and maybe some changes to the module code.  
>
> I love the method described here 
> (http://raincitystudios.com/blogs-and-pods/hubert/a-simple-ajax-image-gallery-system-drupal) 
> using CCK/Views but I can't get Lightbox to navigate through the 
> images.  Not sure if it's possible here.
>
> - John
>
>  
> **************************************************
> John Callahan
> Geospatial Application Developer
> Delaware Geological Survey, University of Delaware
> 227 Academy St, Newark DE 19716-7501
> Tel: (302) 831-3584  
> Email: john.callahan at udel.edu
> http://www.dgs.udel.edu
> **************************************************
>
>   


More information about the support mailing list