让 php 程序显示拍摄数据
范例:http://www.austockphoto.com/Australia_g197-Australian_Roadsign_p12.html
在文件 i-details.php 里,寻找到 第200 行左右, 关键词是:
<?php if((file_exists($stock_photo_path . “m_” . $photo->filename)
在这行的上面,插入以下代码:
— cut —
<?php
//Read and Display EXIF data
$exifDat=@exif_read_data($stock_photo_path . $photo->filename);
$myExif=array(
“Model” => “Model”,
“FocalLength” => “Focal Length”,
“ISOSpeedRatings” => “ISO”,
“ExposureTime” => “Shutter”,
“Lens” => “Lens”,
“LensId” => “Lens Id”
);
if($exifDat)
{
foreach ($myExif as $key => $value)
if(isset($exifDat[$key]) && $exifDat[$key])
if($value == “Focal Length”) {
settype($vala1, “int”);
settype($vala2, “int”);
list($val1, $val2) = split(‘/’, $exifDat[$key]);
echo” <strong>$value</strong>: “.$val1.”mm<br/>”;
}
elseif($value == “Shutter”) {
settype($val3, “integer”);
list($val1, $val2) = split(‘/’, $exifDat[$key]);
echo” <strong>$value</strong>: 1/”.intval($val2/$val1);
}
else {
echo “<strong>$value</strong>: “.$exifDat[$key];
}
if($exifDat['COMPUTED']['ApertureFNumber'])
echo “<strong> Aperture</strong>: “.$exifDat['COMPUTED']['ApertureFNumber'];
if($exifDat['DateTimeOriginal'])
{
$myDate[1]=explode(‘ ‘,$exifDat['DateTimeOriginal']);
$myDate[0]=explode(‘:’,$myDate[1][0]);
echo “<br/><strong>Date</strong>: “.$myDate[0][1].”-”.$myDate[0][2].”-”.$myDate[0][0];
echo “<strong> Time</strong>: “.$myDate[1][1];
}
}
?><br><br>
— cut —
The Date is controled by the following line:
echo “<br/><strong>Date</strong>: “.$myDate[0][1].”-”.$myDate[0][2].”-”.$myDate[0][0];
which is in MMDDYYYY
To change to DDMMYYYY it would be
echo “<br/><strong>Date</strong>: “.$myDate[0][2].”-”.$myDate[0][1].”-”.$myDate[0][0];
近期评论