how to change the background image based on the node (the hard way) I'm trying to change the background image of my site based on what node the user is viewing (not just what node type, but specifically what node). I have added an image field to my node type called background image. Basically, I'm trying to go into my html.tpl.php file and inject a style right into the body tag, for isstance

background-image:url('../images/mybg.jpg');


I'm hoping to grab the image field from node that is loaded, but I'm having trouble figureing out hoe to access a nodes field from the html.tpl.php file (i need to do it from here becuase that's where the body tag is). I've added a pre-process function to my template to try and find the correct field, but i've hit a dead end

function mytheme_preprocess_html(&amp;$vars) {
     dpm($vars);
}


the array that is traced makes no sense to me, and I'm unable to find the field. Is there a better way to do this
The simplest (not necessarily the cleanest) way to do this is:

function mytheme_preprocess_page(&amp;$vars) {
  $node = menu_get_object();
  if ($node-&gt;nid) {
    // We're on a node page
    if (isset($node-&gt;field_background_image[$node-&gt;language][0]['fid'])) {
      // Load the file object
      $file = file_load($node-&gt;field_background_image[$node-&gt;language][0]['fid']);

      // Get a web accessible URL for the image
      $path = file_create_url($file-&gt;uri);

      // Add the background to an inline CSS tag
      drupal_add_css('body { background:url(' . $path . ') left top no-repeat !important; }', 'inline');
    }
  }
}