note 117355 added to function.exif-read-data
| From: | EionRobb | Date: | Tue, 26 May 2015 20:56:16 +0000 |
| Subject: | note 117355 added to function.exif-read-data | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202673@lists.php.net to get a copy of this message | ||
I was needing to use exif_read_data() to read out the orientation flag, only to find that the
webhost didn't have the exif extension available for use. Instead, I hacked up a regex that
worked fairly well as a replacement
<?php
$orientation = 1;
if (function_exists('exif_read_data')) {
$exif = exif_read_data($filename);
if (isset($exif['Orientation']))
$orientation = $exif['Orientation'];
} else if (preg_match('@\x12\x01\x03\x00\x01\x00\x00\x00(.)\x00\x00\x00@',
file_get_contents($filename), $matches)) {
$orientation = ord($matches[1]);
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 131.203.245.222
----
Manual Page -- http://php.net/manual/en/function.exif-read-data.php
Edit -- https://master.php.net/note/edit/117355
Del: integrated -- https://master.php.net/note/delete/117355/integrated
Del: useless -- https://master.php.net/note/delete/117355/useless
Del: bad code -- https://master.php.net/note/delete/117355/bad+code
Del: spam -- https://master.php.net/note/delete/117355/spam
Del: non-english -- https://master.php.net/note/delete/117355/non-english
Del: in docs -- https://master.php.net/note/delete/117355/in+docs
Del: other reasons-- https://master.php.net/note/delete/117355
Reject -- https://master.php.net/note/reject/117355
Search -- https://master.php.net/manage/user-notes.php