Book Image

Drupal 7 Theming Cookbook

By : Karthik Kumar
Book Image

Drupal 7 Theming Cookbook

By: Karthik Kumar

Overview of this book

<p>The greatest strength of Drupal lies in its design which, when employed correctly, allows developers to literally handcraft every aspect of a site, so that it looks and performs exactly how they want it to. While it is reasonably straightforward to download a Drupal theme and install it, doing anything beyond that is not. Using custom themes requires familiarity and experience with Drupal's theming system, especially if you want to easily administer and maintain your themes.</p> <p>Drupal 7 Theming Cookbook provides a plethora of recipes that enable Drupal template designers to make full use of its extensibility and style their site just the way they want it. It is a well-rounded guide which will allow users to take full advantage of Drupal's theming system.</p> <p>This cookbook starts with recipes which address the basics of Drupal's theme system, including regions and blocks. It then moves on to advanced topics such as creating a custom theme and using it to modify the layout and style of content. With the introduction of the Field API and the growing importance of Views and Panels in Drupal 7, chapters have been dedicated to each feature. You will also learn many techniques for dealing with Drupal&rsquo;s templating system, which will allow you create themes which surpass even the existing Drupal and contributed modules.</p>
Table of Contents (18 chapters)
Drupal 7 Theming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Using Image styles to scale and crop images on the fly


Now that we have added image support to the company node type, we can look to style the input images to make them more presentable. When customizing images, we inevitably find ourselves performing a series of repeated steps such as cropping, scaling, resizing, and so on, as per the requirements of our theme. It used to be the case that this procedure had to be performed manually for each image or, if we were a little more proactive, performed through a custom script to apply our changes on the fly. In Drupal 7, we can automate this process and style our images in a non-invasive manner thanks to the tools provided by the Image module in the form of Image styles.

An Image style is a term used to represent the series of operations that we are looking to perform on the image. These operations are known as effects and by default include scale, crop, scale and crop, resize, rotate, and desaturate. Contributed modules can extend this set by...