I have a custom node template that im rendering a variety of fields on, including an image. I want to display it twice with two distinct image styles. I changed the display settings so the initial rendering uses style A, but cant seem to figure out how to add a second instance of the same image using a different style.

Ive seen a variety of suggestions for calling an image and applying a style with php, but they all seem to call in a particular image by URL, while i want to use the field value since each node has its own individual images that im trying to call with the template.

i.e. print render($content['field_image']);

Then later in the template the same image but using a different image style (I realize it probably wont be using the render function.)

Anyone have any pointers?

Thanks.

Comments

boonies’s picture

Jaypan’s picture

The image path will be part of the node object at $node->field_FIELD_NAME[LANGUAGE_NONE][0]['filepath'] (or something like that. You'll have to do some testing on your own). You can then do the following:

print theme('image_style', array('style_name' => 'YOUR STYLE NAME', 'path' => 'path/to/image'));

egitimindir’s picture

thanks jaypan