Php 无法使用render()输出图像

Php 无法使用render()输出图像,php,drupal,drupal-7,drupal-theming,Php,Drupal,Drupal 7,Drupal Theming,我正在尝试输出此图像: 但是,没有打印出来。我的代码是 print render($media_item->field_media_photo['und'][0] 为什么不起作用?改用 改用 改用 改用 那样不行。 最好的方法是使用主题功能 $image = theme('image', $vars); $path = $media_item->field_media_photo['und'][0]['uri']; $vars = array( 'path' =>

我正在尝试输出此图像:

但是,没有打印出来。我的代码是

print render($media_item->field_media_photo['und'][0]
为什么不起作用?

改用

改用

改用

改用

那样不行。 最好的方法是使用主题功能

$image = theme('image', $vars);
$path = $media_item->field_media_photo['und'][0]['uri'];

$vars =  array(
  'path' => $path , 
  'alt' => 'alt',
  'attributes' => array('class' => 'example'),
  );
这里只有路径是必需的。 您可以在.tpl文件中打印变量$image,然后图像就会出现。

这样不行。 最好的方法是使用主题功能

$image = theme('image', $vars);
$path = $media_item->field_media_photo['und'][0]['uri'];

$vars =  array(
  'path' => $path , 
  'alt' => 'alt',
  'attributes' => array('class' => 'example'),
  );
这里只有路径是必需的。 您可以在.tpl文件中打印变量$image,然后图像就会出现。

这样不行。 最好的方法是使用主题功能

$image = theme('image', $vars);
$path = $media_item->field_media_photo['und'][0]['uri'];

$vars =  array(
  'path' => $path , 
  'alt' => 'alt',
  'attributes' => array('class' => 'example'),
  );
这里只有路径是必需的。 您可以在.tpl文件中打印变量$image,然后图像就会出现。

这样不行。 最好的方法是使用主题功能

$image = theme('image', $vars);
$path = $media_item->field_media_photo['und'][0]['uri'];

$vars =  array(
  'path' => $path , 
  'alt' => 'alt',
  'attributes' => array('class' => 'example'),
  );
这里只有路径是必需的。 您可以在.tpl文件中打印变量$image,图像将显示。

更好,使用更好,使用更好,使用更好,使用更好,使用更好