Last active
August 8, 2019 04:17
-
-
Save taskinoz/378438e6436efd9b5e826a592d6bdb4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Better Script: https://stackoverflow.com/questions/900207/return-a-php-page-as-an-image | |
// open the file in a binary mode | |
$name = 'path/to/image.jpg'; | |
$fp = fopen($name, 'rb'); | |
// send the right headers | |
header("Content-Type: image/png"); | |
header("Content-Length: " . filesize($name)); | |
// dump the picture and stop the script | |
fpassthru($fp); | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment