Skip to main content
fixed tiny error in code
Source Link
Clive
  • 167.9k
  • 19
  • 303
  • 337

Here was the function I used

function mytheme_preprocess_page(&$vars) {
    if (isset($vars['node']->nid)
    {
        uri$uri = $vars['node']->field_background_image['und'][0]['uri'];
        $path = file_create_url($uri);
        drupal_add_css('body { background:url(' . $path . ') left top no-repeat !important; }', 'inline');
    }
}

Here was the function I used

function mytheme_preprocess_page(&$vars) {
    if (isset($vars['node']->nid)
    {
        uri = $vars['node']->field_background_image['und'][0]['uri'];
        $path = file_create_url($uri);
        drupal_add_css('body { background:url(' . $path . ') left top no-repeat !important; }', 'inline');
    }
}

Here was the function I used

function mytheme_preprocess_page(&$vars) {
    if (isset($vars['node']->nid)
    {
        $uri = $vars['node']->field_background_image['und'][0]['uri'];
        $path = file_create_url($uri);
        drupal_add_css('body { background:url(' . $path . ') left top no-repeat !important; }', 'inline');
    }
}
Source Link
user379468
  • 2.5k
  • 3
  • 31
  • 49

Here was the function I used

function mytheme_preprocess_page(&$vars) {
    if (isset($vars['node']->nid)
    {
        uri = $vars['node']->field_background_image['und'][0]['uri'];
        $path = file_create_url($uri);
        drupal_add_css('body { background:url(' . $path . ') left top no-repeat !important; }', 'inline');
    }
}