Because of safety (check if user are logged in), I call a php-document when showing images.
...
...&l
Pascal MARTIN is correct that readfile is essentially the same as echo and file_get_contents. I doubt there is any significant difference in performance, but it's clearer to use readfile.
As far as only allowing logged in users to see the images, put the images outside of your web-directory. Using readfile, you can grab the file from some other directory. That way, there's no way they could access it, even if they did guess the url.