사진 EXIF 정보보기
로빈아빠
본문
<?
function getExifInfo($filename,$debug=0) {
$exposureMode = array('Auto Exposure','Manual Exposure','Auto Bracket');
$exposureProgram = array("Not defined","Manual","Program (Auto)","Aperture priority","Shutter priority","Creative program","Action program","Portrait mode","Landscape mode");
$whiteBalance = array("Auto WB","Manual WB");
$meteringMode = array("Unknown","Average","CenterWeightedAverage","Spot","MultiSpot","Multi-segment","Partial");
$flash = array("73"=>"On Compulsory Red-eye reduction","89"=>"On Auto Red-eye reduction","95"=>"On Auto Red-eye reduction");
$erdata = @exif_read_data($filename,0,true);
if (!$erdata||!$erdata["EXIF"]) { return; }
$exif["Make"] = $erdata["IFD0"]["Make"]; // 제조사
$exif["Model"] = $erdata["IFD0"]["Model"]; // 모델
$exif["ExifVersion"] = $erdata["EXIF"]["ExifVersion"]; // EXIF 버전
$exif["DateTime"] = $erdata["EXIF"]["DateTimeOriginal"]; // 촬영일
$exif["Software"] = $erdata["IFD0"]["Software"]; // 사용 Software
$exif["Width"] = $erdata["EXIF"]["ExifImageWidth"]; // 사진 크기
$exif["Height"] = $erdata["EXIF"]["ExifImageLength"]; // 사진 크기
$exif["ExposureMode"] = $exposureMode[$erdata["IFD0"]["ExposureMode"]]; // 노출모드
if (!$exif["ExposureMode"]) { $exif["ExposureMode"] = $exposureMode[$erdata["EXIF"]["ExposureMode"]]; }
$tmp = explode("/",$erdata["EXIF"]["ExposureTime"]); // 노출시간 (셔터스피드)
$exif["ExposureTime"] = $tmp[0]/$tmp[0]."/".$tmp[1]/$tmp[0]."s";
$tmp=null;
$tmp = explode("/",$erdata["EXIF"]["FNumber"]); // 조리개값
$exif["FNumber"] = "F".sprintf("%3.1f",@($tmp[0]/$tmp[1]));
$tmp=null;
$exif["ISO"] = "ISO-".$erdata["EXIF"]["ISOSpeedRatings"]; // ISO 감도
$exif["ExposureProgram"] = $exposureProgram[$erdata["EXIF"]["ExposureProgram"]];
$exif["WhiteBalance"] = $whiteBalance[$erdata["IFD0"]["WhiteBalance"]]; // 화이트벨런스
if (!$exif["WhiteBalance"]) { $exif["WhiteBalance"] = $whiteBalance[$erdata["EXIF"]["WhiteBalance"]]; }
$tmp = explode("/",$erdata["EXIF"]["ExposureBiasValue"]); // 노출보정
$exif["ExposureBias"] = sprintf("%4.2f",@($tmp[0]/$tmp[1]))."EV";
$tmp=null;
$exif["MeteringMode"] = $meteringMode[$erdata["EXIF"]["MeteringMode"]]; // 측광모드
if ($flash[$erdata["EXIF"]["Flash"]]) { $flash_str = " (".$flash[$erdata["EXIF"]["Flash"]].")"; } // 플래시사용여부
$exif["Flash"] = @($erdata["EXIF"]["Flash"]&7)>0?"Flash fired":"Flash not fired";
$tmp = explode("/",$erdata["EXIF"]["FocalLength"]); // 초점거리
$exif["FocalLength"] = @($tmp[0]/$tmp[1])."mm";
$tmp=null;
$tmp = (int)$erdata["COMPUTED"]["CCDWidth"]; // CCD
if ($tmp>0) {
$exif["CCDWidth"] = $tmp."mm";
}
$tmp=null;
$exif["FocalLengthIn35mmFilm"] = $erdata["EXIF"]["FocalLengthIn35mmFilm"]." mm"; // 35인치 환산값
$exif["DigitalZoomRatio"] = $erdata["EXIF"]["DigitalZoomRatio"]; // 줌
$exif["FirmwareVersion"] = $erdata["MAKERNOTE"]["FirmwareVersion"]; // 펌웨어 버전
$exif["Lens"] = $erdata["MAKERNOTE"]["UndefinedTag:0x0095"]; // 사용랜즈 Canon Body & Canon Lens Only
while(list($k,$v)=each($exif)) {
if ($v&&trim($v)!="F"&&trim($v)!="ISO-"&&trim($v)!="EV"&&trim($v)!="mm"&&trim($v)!="s") { $exif_data[$k] = $v; }
}
if ($debug) {
echo "<pre>";
print_r($erdata);
echo "</pre>";
}
//$re = //$exif_data[Model]."*".$exif_data[DateTime]."*".$exif_data[Software]."*".$exif_data[ExposureMode]."*".$exif_data[ExposureTime]."*".$exif_data[FNumber]."*".$exif_data[ISO]."*".$exif_data[WhiteBalance];
//return $re;
$re = "";
foreach($exif_data as $key=>$val){
if($key == "Make") $key = "제조사";
if($key == "Model") $key = "모델";
if($key == "DateTime") $key = "촬영일";
if($key == "Software") $key = "소프트웨어";
if($key == "ExposureMode") $key = "노출모드";
if($key == "ExposureTime") $key = "노출시간";
if($key == "FNumber") $key = "조리개";
if($key == "ISO") $key = "감도";
if($key == "ExposureProgram") $key = "노출방식";
if($key == "WhiteBalance") $key = "화이트발란스";
if($key == "ExposureBias") $key = "노출보정";
if($key == "MeteringMode") $key = "측광방식";
if($key == "Flash") $key = "플래시";
if($key == "FocalLength") $key = "초점거리";
if($key == "FocalLengthIn35mmFilm") $key = "35mm 환산";
if($val == "Aperture priority") $val = "조리개우선(A)";
if($val == "Auto Exposure") $val = "자동노출";
if($val == "Manual") $val = "메뉴얼(M)";
if($val == "Manual Exposure") $val = "수동노출";
if($val == "Multi-segment") $val = "멀티측광";
if($val == "CenterWeightedAverage") $val = "중앙부측광";
if($val == "Flash not fired") $val = "플래시 사용 안함";
if($val == "Flash fired") $val = "플래시 사용 ";
if($val == "Spot") $val = "스팟측광";
if($key == "ExifVersion" || $key == "Width" ||$key == "Height" || $key == "DigitalZoomRatio" ||$key == "CCDWidth") continue;
$re .= $key. " : ".$val."*";
}
return $re;
}
?>
<html>
<head>
<title>eixf 보기</title>
<style type="text/css">
body,div{
font-size:10pt;
}
#exifInfo{
padding:10px;
border:1px solid #c0c0c0;
width:300px; height:100px;
position:absolute;left:100px;top:100px;
background:#FFF;
display:none;
text-align:left;
filter:alpha(opacity=90);
color:gray;
}
#exifInfo ul li{
text-indent:-20px;
list-style:none;
margin:4px;
}
#exifInfo #exifLogo{
width:100%;
font-size:12pt;
font-weight:bold;
background:#c0c0c0;
padding:4px;
color:red;
}
#exifInfo #InfoClose{
border:0px solid;
width:100%;
text-align:center;
padding:4px;
}
#exifInfo #InfoClose span{
background:#000;
cursor:pointer;
padding:14px;
margin:2px;
}
</style>
<script type="text/javascript">
function exifInfoJs(val){
var arr = val.split("*");
var exif = document.getElementById("exifInfo");
var str = "<div id='exifLogo'>+ EXIF Information +</div>";
str += "<ul>";
for(i=0; i<arr.length; i++){
str += "<li>"+arr[i]+"</li>";
}
str += "</ul>";
exif.style.display = "block";
exif.style.left = event.clientX - 20;
exif.style.top = event.clientY+document.body.scrollTop-50;
str += "<div id='InfoClose' onclick='exifclose()'><span>닫기</span></div>";
exif.innerHTML = str;
}
function exifclose(){
var exif = document.getElementById("exifInfo");
exif.style.display = "none";
}
</script>
</head>
<body>
<!--eixf 정보 div-->
<div id="exifInfo"></div>
<img src="dsc.jpg" onClick="exifInfoJs('<?=getExifInfo("dsc.jpg")?>')">
</body>
</html>
http://harogi.net/exif.php
function getExifInfo($filename,$debug=0) {
$exposureMode = array('Auto Exposure','Manual Exposure','Auto Bracket');
$exposureProgram = array("Not defined","Manual","Program (Auto)","Aperture priority","Shutter priority","Creative program","Action program","Portrait mode","Landscape mode");
$whiteBalance = array("Auto WB","Manual WB");
$meteringMode = array("Unknown","Average","CenterWeightedAverage","Spot","MultiSpot","Multi-segment","Partial");
$flash = array("73"=>"On Compulsory Red-eye reduction","89"=>"On Auto Red-eye reduction","95"=>"On Auto Red-eye reduction");
$erdata = @exif_read_data($filename,0,true);
if (!$erdata||!$erdata["EXIF"]) { return; }
$exif["Make"] = $erdata["IFD0"]["Make"]; // 제조사
$exif["Model"] = $erdata["IFD0"]["Model"]; // 모델
$exif["ExifVersion"] = $erdata["EXIF"]["ExifVersion"]; // EXIF 버전
$exif["DateTime"] = $erdata["EXIF"]["DateTimeOriginal"]; // 촬영일
$exif["Software"] = $erdata["IFD0"]["Software"]; // 사용 Software
$exif["Width"] = $erdata["EXIF"]["ExifImageWidth"]; // 사진 크기
$exif["Height"] = $erdata["EXIF"]["ExifImageLength"]; // 사진 크기
$exif["ExposureMode"] = $exposureMode[$erdata["IFD0"]["ExposureMode"]]; // 노출모드
if (!$exif["ExposureMode"]) { $exif["ExposureMode"] = $exposureMode[$erdata["EXIF"]["ExposureMode"]]; }
$tmp = explode("/",$erdata["EXIF"]["ExposureTime"]); // 노출시간 (셔터스피드)
$exif["ExposureTime"] = $tmp[0]/$tmp[0]."/".$tmp[1]/$tmp[0]."s";
$tmp=null;
$tmp = explode("/",$erdata["EXIF"]["FNumber"]); // 조리개값
$exif["FNumber"] = "F".sprintf("%3.1f",@($tmp[0]/$tmp[1]));
$tmp=null;
$exif["ISO"] = "ISO-".$erdata["EXIF"]["ISOSpeedRatings"]; // ISO 감도
$exif["ExposureProgram"] = $exposureProgram[$erdata["EXIF"]["ExposureProgram"]];
$exif["WhiteBalance"] = $whiteBalance[$erdata["IFD0"]["WhiteBalance"]]; // 화이트벨런스
if (!$exif["WhiteBalance"]) { $exif["WhiteBalance"] = $whiteBalance[$erdata["EXIF"]["WhiteBalance"]]; }
$tmp = explode("/",$erdata["EXIF"]["ExposureBiasValue"]); // 노출보정
$exif["ExposureBias"] = sprintf("%4.2f",@($tmp[0]/$tmp[1]))."EV";
$tmp=null;
$exif["MeteringMode"] = $meteringMode[$erdata["EXIF"]["MeteringMode"]]; // 측광모드
if ($flash[$erdata["EXIF"]["Flash"]]) { $flash_str = " (".$flash[$erdata["EXIF"]["Flash"]].")"; } // 플래시사용여부
$exif["Flash"] = @($erdata["EXIF"]["Flash"]&7)>0?"Flash fired":"Flash not fired";
$tmp = explode("/",$erdata["EXIF"]["FocalLength"]); // 초점거리
$exif["FocalLength"] = @($tmp[0]/$tmp[1])."mm";
$tmp=null;
$tmp = (int)$erdata["COMPUTED"]["CCDWidth"]; // CCD
if ($tmp>0) {
$exif["CCDWidth"] = $tmp."mm";
}
$tmp=null;
$exif["FocalLengthIn35mmFilm"] = $erdata["EXIF"]["FocalLengthIn35mmFilm"]." mm"; // 35인치 환산값
$exif["DigitalZoomRatio"] = $erdata["EXIF"]["DigitalZoomRatio"]; // 줌
$exif["FirmwareVersion"] = $erdata["MAKERNOTE"]["FirmwareVersion"]; // 펌웨어 버전
$exif["Lens"] = $erdata["MAKERNOTE"]["UndefinedTag:0x0095"]; // 사용랜즈 Canon Body & Canon Lens Only
while(list($k,$v)=each($exif)) {
if ($v&&trim($v)!="F"&&trim($v)!="ISO-"&&trim($v)!="EV"&&trim($v)!="mm"&&trim($v)!="s") { $exif_data[$k] = $v; }
}
if ($debug) {
echo "<pre>";
print_r($erdata);
echo "</pre>";
}
//$re = //$exif_data[Model]."*".$exif_data[DateTime]."*".$exif_data[Software]."*".$exif_data[ExposureMode]."*".$exif_data[ExposureTime]."*".$exif_data[FNumber]."*".$exif_data[ISO]."*".$exif_data[WhiteBalance];
//return $re;
$re = "";
foreach($exif_data as $key=>$val){
if($key == "Make") $key = "제조사";
if($key == "Model") $key = "모델";
if($key == "DateTime") $key = "촬영일";
if($key == "Software") $key = "소프트웨어";
if($key == "ExposureMode") $key = "노출모드";
if($key == "ExposureTime") $key = "노출시간";
if($key == "FNumber") $key = "조리개";
if($key == "ISO") $key = "감도";
if($key == "ExposureProgram") $key = "노출방식";
if($key == "WhiteBalance") $key = "화이트발란스";
if($key == "ExposureBias") $key = "노출보정";
if($key == "MeteringMode") $key = "측광방식";
if($key == "Flash") $key = "플래시";
if($key == "FocalLength") $key = "초점거리";
if($key == "FocalLengthIn35mmFilm") $key = "35mm 환산";
if($val == "Aperture priority") $val = "조리개우선(A)";
if($val == "Auto Exposure") $val = "자동노출";
if($val == "Manual") $val = "메뉴얼(M)";
if($val == "Manual Exposure") $val = "수동노출";
if($val == "Multi-segment") $val = "멀티측광";
if($val == "CenterWeightedAverage") $val = "중앙부측광";
if($val == "Flash not fired") $val = "플래시 사용 안함";
if($val == "Flash fired") $val = "플래시 사용 ";
if($val == "Spot") $val = "스팟측광";
if($key == "ExifVersion" || $key == "Width" ||$key == "Height" || $key == "DigitalZoomRatio" ||$key == "CCDWidth") continue;
$re .= $key. " : ".$val."*";
}
return $re;
}
?>
<html>
<head>
<title>eixf 보기</title>
<style type="text/css">
body,div{
font-size:10pt;
}
#exifInfo{
padding:10px;
border:1px solid #c0c0c0;
width:300px; height:100px;
position:absolute;left:100px;top:100px;
background:#FFF;
display:none;
text-align:left;
filter:alpha(opacity=90);
color:gray;
}
#exifInfo ul li{
text-indent:-20px;
list-style:none;
margin:4px;
}
#exifInfo #exifLogo{
width:100%;
font-size:12pt;
font-weight:bold;
background:#c0c0c0;
padding:4px;
color:red;
}
#exifInfo #InfoClose{
border:0px solid;
width:100%;
text-align:center;
padding:4px;
}
#exifInfo #InfoClose span{
background:#000;
cursor:pointer;
padding:14px;
margin:2px;
}
</style>
<script type="text/javascript">
function exifInfoJs(val){
var arr = val.split("*");
var exif = document.getElementById("exifInfo");
var str = "<div id='exifLogo'>+ EXIF Information +</div>";
str += "<ul>";
for(i=0; i<arr.length; i++){
str += "<li>"+arr[i]+"</li>";
}
str += "</ul>";
exif.style.display = "block";
exif.style.left = event.clientX - 20;
exif.style.top = event.clientY+document.body.scrollTop-50;
str += "<div id='InfoClose' onclick='exifclose()'><span>닫기</span></div>";
exif.innerHTML = str;
}
function exifclose(){
var exif = document.getElementById("exifInfo");
exif.style.display = "none";
}
</script>
</head>
<body>
<!--eixf 정보 div-->
<div id="exifInfo"></div>
<img src="dsc.jpg" onClick="exifInfoJs('<?=getExifInfo("dsc.jpg")?>')">
</body>
</html>
http://harogi.net/exif.php
관련링크
- http://harogi.net/exif.php 1158회 연결
댓글목록
등록된 댓글이 없습니다.