I want to use Medium image preset on teaser when the article is featured, then change to thumbnail style after. Is it clear? For example, in a cuisine recipes website I want to show a "Recipe of the Day" with a medium style image and tomorrow that recipe will be change by the newest ("Recipe of the Day") and shown with thumbnail style. Is it possible?

Thanks in advance.



You can use Entity View Modes

It will give you the chance to set up a new view mode and change it from Manage Display page. You can create 2 view modes, one for Sticky e one for Recipes of the day. From views page, open the sticky display, click on "Show -> Content > YOUR_VIEW_MODE" and repeat it for the Recipes of the day display/view.

In the manage display page you can set up the image style for the View Mode.



If it's the first item of the list, you can create a view with the featured items and then you can attach the other views to this creating a new Attachment. if you they are random on the list you should create an if statement to check if it's featured or not and print the right image style through

image_style_url('your_style', $node->field_image[LANGUAGE_NONE][0]['uri']);

so it will be something like

if ($node->sticky == 1) {
print "<img src='".image_style_url('medium', $node->field_image[LANGUAGE_NONE][0]['uri'])."' />; } else
print "<img src='".image_style_url('small', $node->field_image[LANGUAGE_NONE][0]['uri'])."' />;
  • I'm afraid don't understand it completely. PLease, check here and you'll see what I want exactly (habana2.bpweb.net/cubarecipesorg/home). BTW, in this particular page I'm using featured content module and panels. You'll see there what I want, We Recommend section with a bigger image than the rest of the recipes content. Thanks – Alex Aug 6 '12 at 16:04
  • It is a field view or a content view? – Tyler Durden Aug 6 '12 at 16:09

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.