<?php
$nid = arg(1);
$arg0 = arg(0);
if(isset($nid) && is_numeric($nid) && isset($arg0) && $arg0 == 'node') {
$node = node_load($nid);
}
$theme_img = file_create_url($node->field_page_cover_image[$node->language][0]['uri']); //origional image path
if(isset($theme_img)) {
// print styled image
print theme('image_style', array('path' => $node->field_page_cover_image[$node->language][0]['uri'], 'style_name' => 'page_theme'));
}
?>
I am using the above code to load styled image (from node 6) in page.tpl file. This is working fine in all the pages but when I am trying to load images from individual images by using '$nid' it is not working.
I don't understand what I made mistake in code due to which I couldn't get the value of '$nid'. Please help.