Image Galleries

Although being able to upload photos is a good start for the Robinson family, Fritz knows that every photo-sharing site needs something like galleries, where users can group photos. In our photo gallery, Fritz identified that a gallery is no more than a grouping of photos under a single name or category. This concept maps directly to

Create Photo

( Browse

( Splir i.i.mm.17 at cursor o Web page addresses and e-mail addresses turn into links automatically, o Allowed HTML tags: <a> <err> ^strong^ <crts> <code>- <o> <dl> <&> o Lines and paragraphs break automatically. More information about formatting options

Figure 7-5. Our new photo submission form when logged in as an authenticated user

Drupal's core Taxonomy module, introduced in Chapter 2. We can set up several predefined galleries by creating a vocabulary with a term for each gallery.

In addition, many photo-sharing sites have the ability to let users freely categorize photos with whatever words they like (called free tagging). This sort of categorization is also supported by Drupal's core taxonomy module.

1. Go to Administer^Content managements-Taxonomy (admin/content/ taxonomy).

2. Click the "Add vocabulary" tab and enter the values from Table 7-5 into the new vocabulary form.

Table 7-5. Values for the new vocabulary for Gallery Setting Value

Identification Vocabulary name Gallery Content types Photo Checked

Settings

Required Checked

Weight -1

The weight value of the Gallery vocabulary must be lower than that of the Tags vocabulary, to make Gallery terms appear before Tag terms, which is important for the Custom Pager that we'll add later.

New Upload:_

Maximum Fileslze: 32 MB Alcwed EKtensions:ipp/pegpng gif

(Upload) Caption:

3. After being returned to the main Taxonomy page, click the "Add vocabulary" tab a second time to set up the free tagging vocabulary with the values in Table 7-6.

Table 7-6. Values for the new vocabulary for Tags Setting Value

Identification Vocabulary name Tags Content types Photo Checked

Settings

Tags Checked

Weight 0

4. The new Tags vocabulary can have new tags added directly on the node form, but our Gallery vocabulary will only display galleries defined by a site administrator. Click the "add terms" link on the Gallery row to populate your site with several starter galleries. The only required field is the Term name; create several terms such as those in Table 7-7 (though you can use any terms you want).

Table 7-7. Sample terms (galleries) for the Gallery vocabulary Term name Sunnyvale family picnic Barcelona vacation Boston road trip Charlie's distraction

The Robinsons can now choose a gallery when they upload or edit a photo. The node edit form for photos at Create Contents-Photo (node/add/photo) should now contain a drop-down list of galleries and a text field for tags such as shown in Figure 7-6.

^ Vocabularies. Gallery: *

1 Kitties and puppies 1 t I

Jsssi_

adorable, cute, mignori

A comma-separated list of terms describing this content. Example: funny, bungee jumping, "Company, Inc.".

Figure 7-6. The fields for selecting a gallery and adding tags

0 0

Post a comment