Last active
June 6, 2018 07:49
-
-
Save sursir/44e8dbda7e9cfc58e78c72b07195f3ce to your computer and use it in GitHub Desktop.
php getimagesize stream file schema getimagesizefromstring
This file contains hidden or 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 | |
| $imageStream = file_get_content('..') or curl_get_content('..'); | |
| if ($info = @getimagesize('data://application/octet-stream;base64,' . base64_encode(imageStream))) { | |
| var_dump($info); | |
| if (isset($info['mime']) && substr($info['mime'], 0, 6) == 'image/') { | |
| $suffix = substr($info['mime'], 6); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment