I need to change these lines (belong to a tpl.php file) to include a image style called "adaptative_image_style" to the generated image.

<?php print l(theme('image', $image_attributes), $ad['url'], $link_attributes); ?>

I think I should use the function to theme_image_style($variables) instead but not sure how to implement it.

Based in Clive's answer I get it working with this code:

  $image_attributes['style_name'] = 'adaptative_image_style';
  print l(theme('image', $image_attributes), $ad['url'], $link_attributes); ?>

The docs page has it pretty much covered but here's an example if you're struggling:

$style_vars = array(
  'style_name' => $style_name,
  'path' => $image_path,
  'alt' => $alt_text

$image = theme('image_style', $style_vars);

$link = l($image, $url, array('html' => TRUE));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.