Image Module

The Image module is the oldest image-related modules in Drupal. It has been an integral part of many "I can't believe it's Drupal" Web sites, including the online arts community at http://www.terminus1525.ca. This module allows users to upload images to Drupal. Images of predefined sizes are automatically created and can be integrated into the site. Specifically, images can be posted individually, included in stories, and grouped into galleries using taxonomy terms. To include a single image per node, users may also use the module Image Attach (which is shipped along with the Image module). A bulk import tool is also provided.

The project page for the Image module is http://drupal.org/project/image. Installation instructions are included in Appendix A of this book. Once the module is installed, you will need to enable the appropriate permissions for module-related functions by navigating to Administer, User management, Permissions.

Images inside your content

The Image module can be integrated with the Image Assist module, thereby allowing users to insert inline images into their posts. Additional information is provided in Chapter 6, which covers theming forms.

When the Image module is enabled, a new content type, "Image," becomes available to users with appropriate permissions. Figure 5.10 shows the form to upload a new image. As with any other content type, you may find this form by navigating to the "Create content" item on the navigation menu (typically displayed as a block).

Default sizes are provided for thumbnails and preview images. You may configure these defaults by navigating to Administer, Site configuration, Images (Figure 5.11). If you change the default image sizes, they will be resized on demand (thereby providing for a distributed server load instead of representing a single hit to the server).

FIGURE 5.10 Uploading a new image with the Image module.

Images Image gallery

Image file settings Default image path:

Subdirectory In the directory "files" where pictures will be stored. Do not include trailing slesh

Maximum upload size:

800 KB

-Image sizes

The Seals image operation resizes images so that they fit nrth in the given dimensions, If only one dimension is specified the other dimension Mill be computed based on the image's aspect ratio, The Scale and crop Image operation resizes mages to he exactly the given dimensions. If only one dimension is specified the image will not be cropped, making this is equivalent to Scale Image

Note: 'Original' dimensions will only be used to resize images when they are first uploaded. Existing originals will not be modified

Label operation width Height Link

Note: 'Original' dimensions will only be used to resize images when they are first uploaded. Existing originals will not be modified

Label operation width Height Link

Original

1 Scale image

M 1

1 1

1 Same window|v

|ïhumbnail

1 Scale image

|ioo

1 I100

1 1 Same window v

Preview

Scale image

M I640

I [640

Same window|v

1

1 Scale image

H 1

1 1

1 1 Same window v

1

Scale image

H 1

1 1

Same window|v

1

1 Scale image

al 1

1 1

1 1 Same window |v

I Saye ccrgLraLcr Reset to defaults"|

I Saye ccrgLraLcr Reset to defaults"|

FIGURE 5.11 Configuring the default image sizes for the Image module.

Galleries

You may create both galleries and subgalleries with the image module-related Gallery module. After enabling the Gallery module, navigate to Administer, Content management, Image galleries. Select "Add gallery" and complete the form (including the "Parent" item to distinguish main galleries from subgalleries).

Two theming functions are available for galleries. At the time of this writing, a template file was not available, however. Thus, to theme the gallery, you must copy the relevant function into your theme's template.php file and adjust the properties as necessary to suit your needs.

1. In your file system, navigate to your modules directory where the Image module is stored.

2. Navigate to the folder image/contrib/image_gallery.

3. Open the file image_gallery.module and look for the function theme_image_gallery.

4. Copy the contents of this function (including the line function theme_ image_gallery) to your theme's template.php file.

5. Alter the name of the function to YOURTHEMENAME_image_gallery (from theme_image_gallery).

6. Adjust the contents of this function to match your desired output.

7. Clear the theme registry by navigating to Administer, Site configuration, Performance. Scroll to the bottom of the Web page and click "Clear cached data."

Repeat these steps for the function theme_image_gallery_img in the file image_ gallery.module.

Make Money Writing

Make Money Writing

This Report Will Show You How To Make Money By Providing Writing Services To Other Internet Marketers. Learn how to make money by writing the right way. Grab your copy of this report now and learn. Why writing is a great way to earn money. How to compete with cheap writers, even if you charge a lot more money.

Get My Free Ebook


Post a comment