Skip to content

Instantly share code, notes, and snippets.

@taskinoz taskinoz/ReturnImage.php
Last active Aug 8, 2019

What would you like to do?
// Better Script:
// 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.