Simple Drupal image gallery
Credit where credit's due -- The Art Lab's original post about this "maintainable gallery". I'm only updating this with adding on how to do multiple galleries. First: a fresh install on Drupal 5.8 (Drupal 6 modules aren't QUITE there yet, I tried!) Enable Clean URLs
Required modules
<!--more--> Enable the following on your Modules page:
- Content
- Imagefield
- ImageAPI
- ImageAPI GD2 or ImageAPI ImageMagick
- Imagecache
- Imagecache UI
- Thickbox
- Bonus: grid view
- Views
- Views UI
Make the Imagecache presets Site building --> Imagecache --> Add New Preset Make one called "thumbnail."
And make one called "display."
Add Image Content Type Add new content type called "Image" and then click "Add Field." Call it "photo" and select Image as the field type. Click on "Display Fields" and choose "Hidden" for the label, "Thickbox thumbnail" as the teaser and "Thickbox display" as the Full. (This step is not necessary -- but would be helpful if you were using this field for Page content that had a teaser block or a teaser on the front page.) Add Gallery View Now make a new View called Gallery. Under Page, check Provide Page View. Make the URL "gallery." Select Bonus: Grid View for the View Type, check Use Pager and enter 24 as the number of Nodes per Page. Go down to Fields and select Image: Photo (field_photo). Select Do not group multiple values and select Thickbox: thumbnail under Option. Under Filters, select Node: Type is one of Image and Node: Published Equals Yes. Click save. Test! Go to Create content --> Image to add your first image to the gallery. To make sure it worked, go to yoursite.com/gallery.
If this all goes well, you are ready to use taxonomy to make multiple galleries! Categories Adding categories to your content is an easy way to organize it, and is especially powerful when combined with Views. Go to Administer --> Content Management --> Categories and click on "Add Vocabulary." This is the name of the type of category this is. So, Gallery or Image Gallery would be good fit. Now, you need to add terms to make your different galleries. In my case, I'd like to make a gallery for different photo subjects, like Gardening, Dog and Remodeling. Click Add Terms, and add these in, one at a time.
Let's try adding a new image and tagging it with a category. It will still show up in your gallery because you have not filtered the galleries yet. Go to Administer --> Site building --> Views Next to your Gallery view, click the "Clone" button. This will duplicate your Gallery view and you can edit it to filter ONLY the Images tagged with "Dog." Change the name, description and url. Under filters, select Taxonomy: Terms for Gallery. Select Dog next to "Is All Of" in the filter and Save. Now check your new URL for this filtered gallery! If there is time remaining, we will go over adding an image field to Page content. ADDED AFTER DRUPAL DAZE PRESENTATION You can also do some really cool stuff by adding an exposed filter to the gallery, letting people select which gallery to view -- or by using arguments in your original view to dynamically create your galleries! These came out of our discussion after the presentation, very cool!







Comments
Post new comment