how to use images uploaded to public:// with a form I've got the possibility to upload images, this is the piece of code that says where the files go: '#upload_location' =&gt; 'public://',

this is the piece of code which generates the rows in my table view:

$rows[] = array(
        'data' =&gt; array(
            l($node-&gt;id, 'node/'. $node-&gt;id),
            $node-&gt;url,
            $node-&gt;title,
            $icon = "&lt;img src='$node-&gt;icon'&gt;",
            $node-&gt;created,
            $delete = "&lt;a id='delete' href='$node-&gt;id/delete'&gt; " . t('Delete') . "&lt;/a&gt; | &lt;a id='edit' href='$node-&gt;id/edit'&gt; " . t('Edit') . "&lt;/a&gt;"
        )
  );


notice '$icon'. $node->icon returns for example usa.gif. But of course the path is invalid. 

The question is: how can I use my images? I cant figure it out

There's probably some drupal way to do this, advice is highly appreciated!
If $node-&gt;icon is the path relative to public://, then you can use the following code.

if ($wrapper = file_stream_wrapper_get_instance_by_uri("public://{$node-&gt;icon}")) {
  $url = $wrapper-&gt;getExternalUrl();
}


The code works also for stream wrappers that are not local, for which the file is not local to the server running the code.