Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function get_exif($filename, $gallery)
{
if(!extension_loaded('exif'))
{
return "Exif Support Not Loaded";
}
else
{
/* In my gallery code all my images are under the gallery folder, under a specific gallery, the path below can be changed to where you images are located. */
$imagepath = $_SERVER['DOCUMENT_ROOT']."/gallery/".$gallery."/".$filename.".jpg";
/* next line obtains the exif data from the images the second parameter can be changed to 'EXIF' but seems 'IFD0' works fine for the list of information I need */
@$exif = exif_read_data($imagepath, 'IFD0');
/* Because manufacture vary , the exif information provided isnt always in the same name, I check to see if at least two of the exif information is not blank, if they are then I assume no valid exif information is present. */
if (($exif['FNumber'] == "") || ($exif['FocalLength'] == ""))
return "No EXIF Data";
else
{
@$exif = exif_read_data($imagepath, 'IFD0', true);
//uncomment the next code block, if you wish to see ALL values inside of the exif information, useful for finding the exact keys you want beforehand
/*
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "<!-- $key.$name: $val -->\n";
}
}
*/
//convert the raw values to understandible values
$Fnumber = explode("/", $exif['EXIF']['FNumber']);
$Fnumber = $Fnumber[0] / $Fnumber[1];
$Focal = explode("/", $exif['EXIF']['FocalLength']);
$Focal = $Focal[0] / $Focal[1];
//prepare the text for return
$exif_text = "Model: ".$exif['IFD0']['Model']."<br>";
$exif_text = $exif_text."Shutter: ".$exif['EXIF']['ExposureTime']."<br>";
$exif_text = $exif_text."Aperture: f/".$Fnumber."<br>";
$exif_text = $exif_text."ISO Speed: ".$exif['EXIF']['ISOSpeedRatings']."<br>";
$exif_text = $exif_text."Focal Length: ".round($Focal)."mm<br>";
return $exif_text;
}
}
}