(PHP) Returning picture from a directory
<p>In my Product Class, there is a function called pictures() which returns the file address of the picture of a product. It's something like this:</p>

<pre><code>public function picture()
{
    $file = "images/pictures/products/" . $this-&gt;id . ".png";
    if(file_exists($file))
        return $file;
    else
        return false;
}
</code></pre>

<p>It works fine when running the code on the administration area of the website (which is located on /admin/ directory)</p>

<p>But when I call this function from the index.php which is not on the /admin/ directory it always returns false. What should I do? The only way I figured to solve this is by creating a parameter on the picture() function, like: picture($directory_prefix) then that way I'll call the function with picture("/admin/"). But there's gotta be a better way than this...</p>
