Skip to content

Instantly share code, notes, and snippets.

@nlively
Created March 30, 2012 15:10
Show Gist options
  • Save nlively/2252186 to your computer and use it in GitHub Desktop.
Save nlively/2252186 to your computer and use it in GitHub Desktop.
Drupal: Display an image from a node in a form.
<?php
$node = node_load(NID_HERE);
if ($node->field_image[LANGUAGE_NONE][0]['fid']) {
$file = file_load($node->field_image[LANGUAGE_NONE][0]['fid']);
$form['image_preview'] = array(
'#markup' => theme('image', array('uri' => $file->uri));
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment