Earlier quoted context omitted.
But almost any site will be sending the image along with a Content-type header, so your browser would still open it up as an image, not an HTML page with JavaScript? Or no?
If you can control the filename, you can do things like embed into an image, put it up as foo.jpg.php, and then execute it by hitting the 'image' directly. That's... sadly common.
If you are inspecting binary data for validity, and not checking the parameter (filename) that affects how Apache serves your file, you are doing something wrong.