1

I've a code which theme & print the original image to specific image style.

print theme('image_style', array(
  'path' => $node->field_theme_image[$node->language][0]['uri'],
  'style_name' => 'home_theme',
));

I don't figure out how to get url of this new theme. I don't need to print the image but I need just url. Please suggest.

0

You need to use the image_style_url function instead of theme.

$path = image_style_url('home_theme', $node->field_theme_image[$node->language][0]['uri']);
| improve this answer | |
  • This is not the correct way to do this. See this article: computerminds.co.uk/articles/… also I have a way to do this without writing a single line of code. See my answer below. – Allan Oct 15 '15 at 15:24

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.