Drupal – Get Image/File path by File ID(fid)

You can get the image/file path by fid using the field_flie_load() function.

<?php
  // Load the node with nid = 10
  $display_node = node_load(10);
  // Load the file by fid
  $file = field_file_load($display_node->field_file[0]['fid']);
  // print the relative file path
  print $file['filepath'];
?>

 

Done =)

Reference: Drupal – Getting the image path of a CCK field

Advertisement

10 thoughts on “Drupal – Get Image/File path by File ID(fid)”

  1. Trying to pass image path URL (from image uploaded in a Webform) to Salesforce via the Salesforce Web-To-Lead Module. All of the other fields in the webform get send to Salesforce fine, except the image file upload. WebForm just sends the fid vs. the URL?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.