Syntax problem when checking for a file
<p>This piece of code has previously worked but I have C&amp;P it to a new place and for some reason, it now won't work!</p>

<pre><code>        &lt;?
        $user_image = '/images/users/' . $_SESSION['id'] . 'a.jpg';
        if (file_exists(realpath(dirname(__FILE__) . $user_image))) 
        {
            echo '&lt;img src="'.$user_image.'" alt="" /&gt;';
        } 
        else 
        {
            echo '&lt;img src="/images/users/small.jpg" alt="" /&gt;';
        }
        ?&gt;
</code></pre>

<p>As you can see, I am checking for a file, if exists, showing it, if not, showing a placeholder. </p>

<p>The $_SESSION['id'] variable does exist and is being used elsewhere within the script.</p>

<p>Any ideas what the problem is?</p>

<p>Thanks</p>
