Taken Date, Modified Date dengan Exif Read Data dari Detail
02-11-2018 Admin FnF
Taken Date, Modified Date dengan Exif Read Data dari Detail

Selamat datang di website FnF Indonesia. Apa saja yang harus dipersiapkan untuk belajar pemrograman? FnF Indonesia akan membantu untuk memberitahukan apa saja yang harus dipersiapkan. Yuk Simak di indofnf.com.

Taken date adalah foto yang pertama kali diambil oleh media kamera HP, Kamera Digital dan lain sebagainya. Fitur Detail didalamnya sangat banyak sekali, tetapi Kami akan membagikan untuk mengambil Taken Date.

echo "test1.jpg:
\n"
; $exif = exif_read_data('tests/test1.jpg', 'IFD0'); echo $exif===false ? "No header data found.
\n"
: "Image contains headers
\n"
; $exif = exif_read_data('tests/test2.jpg', 0, true); echo "test2.jpg:
\n"
; foreach ($exif as $key => $section) { foreach ($section as $name => $val) { echo "$key.$name: $val
\n"
; } }


Kita coba buat cara lain :

Kita buat Function dulu


// This function is used to determine the camera details for a specific image. It returns an array with the parameters.
function cameraUsed($imagePath) {

// Check if the variable is set and if the file itself exists before continuing
if ((isset($imagePath)) and (file_exists($imagePath))) {

// There are 2 arrays which contains the information we are after, so it's easier to state them both
$exif_ifd0 = read_exif_data($imagePath ,'IFD0' ,0);
$exif_exif = read_exif_data($imagePath ,'EXIF' ,0);

//error control
$notFound = "Unavailable";

// Make
if (@array_key_exists('Make', $exif_ifd0)) {
$camMake = $exif_ifd0['Make'];
} else { $camMake = $notFound; }

// Model
if (@array_key_exists('Model', $exif_ifd0)) {
$camModel = $exif_ifd0['Model'];
} else { $camModel = $notFound; }

// Exposure
if (@array_key_exists('ExposureTime', $exif_ifd0)) {
$camExposure = $exif_ifd0['ExposureTime'];
} else { $camExposure = $notFound; }

// Aperture
if (@array_key_exists('ApertureFNumber', $exif_ifd0['COMPUTED'])) {
$camAperture = $exif_ifd0['COMPUTED']['ApertureFNumber'];
} else { $camAperture = $notFound; }

// Date
if (@array_key_exists('DateTime', $exif_ifd0)) {
$camDate = $exif_ifd0['DateTime'];
} else { $camDate = $notFound; }

// ISO
if (@array_key_exists('ISOSpeedRatings',$exif_exif)) {
$camIso = $exif_exif['ISOSpeedRatings'];
} else { $camIso = $notFound; }

$return = array();
$return['make'] = $camMake;
$return['model'] = $camModel;
$return['exposure'] = $camExposure;
$return['aperture'] = $camAperture;
$return['date'] = $camDate;
$return['iso'] = $camIso;
return $return;

} else {
return false;
}
}

?>

setelah selesai membuat function kita ambil gambar atau foto kemudian kita coba cek detailnya menggunakan fungsi berikut :

$camera = cameraUsed("/img/myphoto.jpg");
echo "Camera Used: " . $camera['make'] . " " . $camera['model'] . "
";
echo "Exposure Time: " . $camera['exposure'] . "
";
echo "Aperture: " . $camera['aperture'] . "
";
echo "ISO: " . $camera['iso'] . "
";
echo "Date Taken: " . $camera['date'] . "
";

?>

 
Selamat mencoba, semoga bermanfaat.