I'm using to show exif data of a picture.
this is the code
<?php
$filename = "http://www.rallyfun.net/images/20140921231511_img_7369.jpg";
$exif = exif_read_data($filename, 0, true);
echo "Exposure: " . $exif["EXIF"]["ExposureTime"] . " sec.<br />";
echo "F: " . $exif["EXIF"]["FNumber"] . "<br />";
echo "ISO: " . $exif["EXIF"]["ISOSpeedRatings"] . "<br />";
?>
this is the result:
Exposure: 1/6400 sec.
F: 63/10 sec.
ISO: 1000
the result is ok except for the aperture: it must be displayed as (in this case) 6.3 so i need to divide the first number (63) with the number after the "/" (10).
how?
U can use explode for this.
$tmp = explode('/', str_replace(' sec.', '', $exif["EXIF"]["FNumber"]));
echo "F: " . ($tmp[0]/$tmp[1]) . "sec<br />";