Created
September 19, 2012 18:55
-
-
Save jhansche/3751491 to your computer and use it in GitHub Desktop.
getimagesizefromstring() replacement
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
function getmimetypefromstring($data) | |
{ | |
// Most image types can be determined in 25 bytes or less. | |
$data = substr($data, 0, 32); | |
$uri = 'data://application/octet-stream;base64,' . base64_encode($data); | |
return exif_imagetype($uri); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment