Created
February 11, 2013 14:14
-
-
Save atomize/4754628 to your computer and use it in GitHub Desktop.
Get image DPI in flat PHP
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
function get_dpi($filename){ | |
$a = fopen($filename,'r'); | |
$string = fread($a,20); | |
fclose($a); | |
$data = bin2hex(substr($string,14,4)); | |
$x = substr($data,0,4); | |
$y = substr($data,0,4); | |
return array(hexdec($x),hexdec($y)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this behaves weird, just a note.