18.10.2016 Views

Drupal 7 Module Development

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 11<br />

This is where you can start adding new manipulations (or, in <strong>Drupal</strong> parlance,<br />

'effects') to your image. As you can see from the drop-down menu shown, all of<br />

the standard <strong>Drupal</strong> effects are available to be used. When you select an effect<br />

and click on the Add button, you may get a configuration form that allows you to<br />

specify options for that effect. Typically these configuration options will match the<br />

arguments of the associated functions. So the Desaturate effect does not have a<br />

configuration form, but the Scale effect does, as shown:<br />

Once the appropriate options are entered and saved, the styles screen will be<br />

updated with a live preview of what the new effect will look like. As you add more<br />

and more effects, this live update will continue to reflect them. You can also adjust<br />

the order in which the effects are applied, since this can vastly affect the resulting<br />

image. Rotating before a crop results in an image that is different from one that is<br />

cropped before rotating.<br />

This may seem like a lot of configuration information for a book focused on coding,<br />

but it provides the context for what we're about to do. As you can see, all of <strong>Drupal</strong>'s<br />

built in effects are available for use in a style, but what if you need an effect that isn't<br />

listed? For instance, a common effect is to add a text watermark to your images. Let's<br />

look at how we might do that.<br />

[ 333 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!