I recently began storing image uploads outside the webroot and retrieving them via readfile(). I implemented this and it's working fine, but I was curious if there are any further vulnerabilities that still exist in this method.
If I take the contents of a malicious script from outside the web-root via readfile() and output it on a php script that has an image content-type will this force the browser to always interpret this data as an image or is there some way a user could circumvent this and use it to run a malicious script?