How do I specify an image style in my preprocess function? In my current project, whenever a node's image field is empty, I'm filling it with the image from an entity referenced in the node. To pull this off, I'm using this magical piece of code in template.php:

// Implements hook_preprocess_node();
    function mycustomtheme_preprocess_node(&amp;$vars) {

      $node = $vars['node'];
      $field_name = 'field_main_image';
      if (
        isset($node-&gt;$field_name) &amp;&amp;
        empty($node-&gt;$field_name)
      ) {
        $node_wrapper = entity_metadata_wrapper('node', $node);
        if ($node_wrapper-&gt;field_master_reference-&gt;raw()) {
          $project = $node_wrapper-&gt;field_master_reference-&gt;value();
          $vars['content'][$field_name] = field_view_field('node', $project, $field_name);
        }
      }
    }


It works superbly - but with one small problem: it doesn't give the image its correct image style. In fact it just spits out the original image.  

How can I force it to use the field's image style?
Have you tried render

// Implements hook_preprocess_node();
    function mycustomtheme_preprocess_node(&amp;$vars) {

      $node = $vars['node'];
      $field_name = 'field_main_image';
      if (
        isset($node-&gt;$field_name) &amp;&amp;
        empty($node-&gt;$field_name)
      ) {
        $node_wrapper = entity_metadata_wrapper('node', $node);
        if ($node_wrapper-&gt;field_master_reference-&gt;raw()) {
          $project = $node_wrapper-&gt;field_master_reference-&gt;value();
          $vars['content'][$field_name] = render($vars['content'][$field_name]);
        }
      }
    }