Прочитать Exif данные из файла
Code (php)
-
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
<head>
-
<title>Extract Exif-Data Demo</title>
-
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-
</head>
-
<body>
-
<?php
-
function printExif($fileName)
-
{
-
// Written in 2007 by Sascha Tayefeh
-
// http://www.tayefeh.de
-
// This code is FREE for all
-
echo "exif library present";
-
else
-
echo "exif library absent";
-
-
-
"FocalLength" => "Focal Length",
-
"ISOSpeedRatings" => "ISO",
-
"ExposureTime" => "Shutter",
-
"Make" => "Manufacturer",
-
"Model" => "Model",
-
"Software" => "Software",
-
"FNumber" => "Focal Number",
-
"Country" => "Country",
-
"Lens" => "Lens",
-
"LensId" => "Lens Id"
-
);
-
-
if($exifDat)
-
{
-
foreach ($myExif as $key => $value)
-
echo "
-
<strong>$value</strong>: ".$exifDat[$key];
-
-
if($exifDat[‘COMPUTED’][‘ApertureFNumber’])
-
echo "
-
<strong>Aperture</strong>: ".$exifDat[‘COMPUTED’][‘ApertureFNumber’];
-
-
<strong>Flash</strong>: shot";
-
<strong>Flash</strong>: not shot";
-
-
if($exifDat[‘DateTimeOriginal’])
-
{
-
-
echo "
-
<strong>Date</strong>: ".$myDate[0][2]."-".$myDate[0][1]."-".$myDate[0][0];
-
echo "
-
<strong>Time</strong>: ".$myDate[1][1];
-
}
-
-
}
-
} // End Function
-
-
{
-
?>
-
<h1>Extract some Exif-Data from file</h1>
-
<form enctype="multipart/form-data"
-
action="<? echo $_SERVER[’PHP_SELF’]; ?>"
-
method="post"
-
>
-
<dl>
-
<dt>ImageFile URL:</dt>
-
<dd><input type="file" name="imgFile" size="40" /></dd>
-
<dt> </dt>
-
<dd><input type="submit" value="Start Upload (may take a while)" /></dd>
-
</dl>
-
<input style="display: none" name="go" value="analyse" />
-
</form>
-
<?
-
} else {
-
?>
-
<h1>Exif-Data:</h1>
-
<?
-
$img=$_FILES[‘imgFile’][‘tmp_name’];
-
printExif($img);
-
?>
-
-
<?
-
} // END IF POST
-
?>
-
-
</body>
-
</html>
-
