note 85711 added to function.imagejpeg
| From: | dot) | Date: | Sat, 13 Sep 2008 13:50:16 +0000 |
| Subject: | note 85711 added to function.imagejpeg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144394@lists.php.net to get a copy of this message | ||
For those looking to grab the resolution of a JPEG image without using GD nor ImageMagic... I wrote
this simple function.
Too bad GD doesn't have this very simple function for us to use...
<?php
function getJPEGresolution($filename){
$outRez=array();
// Read the file
ob_start(); // start a new output buffer
$image = file_get_contents($filename);
// grab DPI information from the JPG header
$outRez["xDPI"] = ord($image[15]);
$outRez["yDPI"] = ord($image[17]);
ob_end_clean(); // stop this output buffer
//xDPI and yDPI should equal in value... but we output both anyway...
return($outRez);
}//end function getJPEGresolution
?>
----
Server IP: 61.195.146.164
Probable Submitter: 124.85.118.11
----
Manual Page -- http://www.php.net/manual/en/function.imagejpeg.php
Edit -- https://master.php.net/note/edit/85711
Del: integrated -- https://master.php.net/note/delete/85711/integrated
Del: useless -- https://master.php.net/note/delete/85711/useless
Del: bad code -- https://master.php.net/note/delete/85711/bad+code
Del: spam -- https://master.php.net/note/delete/85711/spam
Del: non-english -- https://master.php.net/note/delete/85711/non-english
Del: in docs -- https://master.php.net/note/delete/85711/in+docs
Del: other reasons-- https://master.php.net/note/delete/85711
Reject -- https://master.php.net/note/reject/85711
Search -- https://master.php.net/manage/user-notes.php