Search code examples
phpdrupaldrupal-7drupal-theming

Cannot output image using render()


I am trying to output this image :

enter image description here

However, nothing gets printed out. My code is

print render($media_item->field_media_photo['und'][0]

Why doesn't it work?


Solution

  • Use image_style_url instead.

    $image_uri = $media_item->field_media_photo['und'][0]['uri'];
    $image_stylePath = image_style_url("large", $image_uri);
    print theme("image", array(
        'path' => $image_stylePath
    ));