I have a view where I can't use fields (the reason is complicated but I have to list the content as full content). I'm trying to figure out how to use differnt image styles from withing the node template. For instance, I have two image styles one that is 120 x 120 and one that is 360 x 360. I want to make the node template behave so that the first row displays the 360 x 360 and the subsequent rows display 120 x 120, but I can't figure out how to apply the image style to the field within the node template.
-
It sounds like something isn't quite right about your setup if you can't use the fields output, but anyway, I posted an answer that I hope is helpful. :)– LetharionCommented Jan 9, 2012 at 18:33
-
well the issue is with the comments, I have some other pending question about grouping comments. (drupal.stackexchange.com/questions/18804/…) Essentially I'm trying to show a view of nodes and comments ...it seems the only way I can get the comments to display the way I want is to use the node format in views.– user379468Commented Jan 9, 2012 at 19:06
Add a comment
|
2 Answers
I found this code somewhere as well and it seems to work within the template file.
print theme('image_style', array( 'path' => $field_my_image[0]['uri'], 'style_name' => 'square_550'));
where the field_my_image is the name of your field .... I suppose it does the same as the above code.
You could use image_style_url($style, $uri);
foreach($node->imagefield[LANGUAGE_NONE] as $image) {
echo '<img src = "' . image_style_url('style-name', $image['uri']) . '">';
}