File_load for image path errors when empty I need to print the URL of an image in a content type TPL file. I can do this with the following code: 

&lt;?php $file = file_load($node-&gt;FIELD_NAME['und'][0]['fid']); ?&gt;
&lt;?php print file_create_url($file-&gt;uri); ?&gt;


However if the field is empty then I get errors on the screen. I tried only printing the URL if $file had a value: 

&lt;?php if (!empty($file)): ?&gt;
  &lt;?php print file_create_url($file-&gt;uri); ?&gt;
&lt;?php endif; ?&gt;


However im still getting the errors if the field is empty. I understand that it is the first line of the code which creates the variable that is causing the issue. How can I rewrite this to not cause errors? 

By the way im a themer not a back-end developer so if there is a more 'themer friendly' solution that would be my preference.
Found the answer here: http://www.drupalden.co.uk/rendering-drupal-7-fields-custom-node.tpl.php-templates 

&lt;?php
// field_my_image is the name of the image field

  // using field_get_items() you can get the field values (respecting multilingual setup)
  $field_my_image = field_get_items('node', $node, 'field_my_image');

  // after you have the values, you can get the image URL (you can use foreach here)
  $my_image_url = file_create_url($field_my_image[0]['uri']);

  print $my_image_url;
?&gt;