-
- $size = getimagesize($filename); //Get mime information
- $fp=fopen($filename, "rb"); //Open the file in binary mode
- if ($size && $fp) {
- header("Content-type: {$size['mime']}");
- fpassthru($fp); // Output to browser
- exit;
- } else {
- // error
- }
- ?>
-
Copy code
The amount of code is less than 1/10 of the original, and the speed is N times faster.
|