Get the right path to the file
<p>I store user images in "images" forlder and the full path is something like this:</p>

<blockquote>
  <p><a href="http://example.com/images/imagename.jpg" rel="nofollow">http://example.com/images/imagename.jpg</a></p>
</blockquote>

<p>When I try to get the image path like this:</p>

<pre><code>$path = 'images/imagename.jpg';
</code></pre>

<p>it works fine on home page, but since I have different permalink structure it doesn't work on other pages. It becames something like <a href="http://example.com/something/images/imagename.jpg" rel="nofollow">http://example.com/something/images/imagename.jpg</a></p>

<p>Of course I can write:</p>

<pre><code>$path = 'http://example.com/images/imagename.jpg';
</code></pre>

<p>but in this case</p>

<pre><code>file_exists($path)
</code></pre>

<p>always returns false even if the file exists. It's a problem!</p>

<p>Can anyone please help?</p>
