How to Apply Image Styles

To apply image styles to to your images you can use this hook. The rules can be very general like this, or as specific as each field having it's own.

The image styles themselves are defined in Drupal, under Configuration > Image styles.

// This says to use the ipad style for all our fields, except for index pages
function {MODULE_NAME_HERE}_pugpig_image_style($field_name) {
   if ($field_name === 'field_thumbnail_image') {
     return 'thumbnail_image';
  return 'full_image';
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Powered by Zendesk