note 113834 added to function.exif-read-data

From: Date: Fri, 06 Dec 2013 09:19:10 +0000
Subject: note 113834 added to function.exif-read-data
Groups: php.notes 
Request: Send a blank email to php-notes+get-197806@lists.php.net to get a copy of this message
Following up on darkain at darkain dot com script for grabbing the ShutterSpeedValue from exif data... @http://php.net/manual/en/function.exif-read-data.php I have found that the option shown for ShutterSppedValue, can also be ExposureTime in the exif data. Also the code as written provides a WRONG return, as the return is always 1 so you get 1/1sec. Here is corrected code, or a version that corrects what is obviously not working after 5 years since it was originally developed:: Here is the updated version for:: $exif[ExposureTime] function exif_get_float($value) { $pos = strpos($value, '/'); if ($pos === false) return (float) $value; $a = (float) substr($value, 0, $pos); $b = (float) substr($value, $pos+1); return ($b == 0) ? ($a) : ($a / $b); }; function exif_get_exposureTime(&$exif) { if (!isset($exif['ExposureTime'])) return false; $apex = exif_get_float($exif['ExposureTime']); $shutter = 1/$apex; // above 1 sec exposure time:: if ($shutter <= 1) return round($apex) . ' seconds'; return '1/' . round(1 / $apex) . 'sec'; }; ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.exif-read-data.php Edit -- https://master.php.net/note/edit/113834 Del: integrated -- https://master.php.net/note/delete/113834/integrated Del: useless -- https://master.php.net/note/delete/113834/useless Del: bad code -- https://master.php.net/note/delete/113834/bad+code Del: spam -- https://master.php.net/note/delete/113834/spam Del: non-english -- https://master.php.net/note/delete/113834/non-english Del: in docs -- https://master.php.net/note/delete/113834/in+docs Del: other reasons-- https://master.php.net/note/delete/113834 Reject -- https://master.php.net/note/reject/113834 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197806) next »