在Drupal 7中获取field_image路径

Boo*_*ski 1 php drupal-7

在Drupal 6中,我将执行以下操作以在我的节点中获取图像 - articles.tpl.php页面:

<?php
$cck_images = $node->field_image;

if (count($cck_images)>0) :
    foreach ($cck_images as $cck_image) :
        $image = theme('imagecache', 'large', $cck_image['filepath'], $cck_image['data']['alt'], $cck_image['data']['title']);
        print $image;
    endforeach;
endif;
?>
Run Code Online (Sandbox Code Playgroud)

但是,在Drupal 7中没有'['filepath']',我尝试过使用:

<?php print_r($field_image); ?>
Run Code Online (Sandbox Code Playgroud)

但变量不存在.我知道Drupal 7仍然处于alpha状态,但任何帮助都会非常感激!

小智 9

试试这个:

<?php
$nid = 4; 
$node = node_load($nid);
?>
<img src="<?php echo render(file_create_url($node->field_image['und'][0]['uri'])); ?>" />
Run Code Online (Sandbox Code Playgroud)