Can I access public:// from inside a module? I need to load an image that's uploaded to the public folder from within a module

In the module itself:

function mymodule_dashboard() {
   GLOBAL $user;
   $profile = profile2_load_by_user($user-&gt;uid, 'personal_information');
   $data['avatar'] = $profile-&gt;field_picture['und'][0]['uri'];


In my dashboard.tpl.php:

&lt;img src="&lt;?php echo $data['avatar']; ?&gt;" /&gt;


The rendered content:

&lt;img src="public://image.jpg"&gt;


I can pull the image name and build the path myself, but I'm looking for a way to actually take advantage of this public folder business
You're looking for the file_create_url() function:


  Creates a web-accessible URL for a stream to an external or local file.


e.g.

$data['avatar'] = file_create_url($profile-&gt;field_picture['und'][0]['uri']);