How to render an Image Field as a URL in node.tpl.php I have an image field called field_body_image

I want to render it in my tpl.php file with a custom image style. I am using the following code (from this thread) to do this:

&lt;?php $view = field_view_field('node', $node, 'field_body_image', array('settings' =&gt; array('image_style' =&gt; 'thumbnail')));?&gt;
&lt;?php print render($view); ?&gt;


However, I want to display the URL of the image. How can I do that?

This thread has a solution, but it is for user photos and so you cannot specify a custom field.

Image Url Formatter is a module that can do this, but I would rather achieve it without an extra module. 

This page has some advice, but apparently it is not best practice.
You can do this by getting the path to the file. 

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


Then render the path:

&lt;?php print file_create_url($file-&gt;uri); ?&gt;


I tested this and it works. In my case I had an event image in my local dev site and it rendered:

http://events.dev/sites/default/files/event-images/imagefield_7tgPJ7_0.jpg


In your tags, you did not specify Drupal 6 or 7 but my code above would be for Drupal 7.