Server-side/PHP
이미지 정보 추출 메소드
그곰
2011. 8. 31. 17:04
Function 파일을 생성하여 include하시면 된다.
function IMG_EXIF($img) {
$exif = read_exif_data($img);
while(list($k, $v) = each($exif)) {
if($k == "FileSize") { // 이미지 용량
$info['FileSize'] = $v;
} else if ($k == "ImageDescription") {
$info['ImageDescription'] = $v;
} else if ($k == "Model") { //카메라모델
$info['Model'] = $v;
} else if ($k == "DateTime") { //찍은시간
$info['DateTime'] = $v;
} else if ($k == "Flash") { //플래쉬
if ($v == 1) {
$info['Flash'] = "YES";
} else {
$info['Flash'] = "NO";
}
} else if ($k == "ISOSpeedRatings") { //iso
$info['ISOSpeed'] = "ISO ".$v;
} else if ($k == "FNumber") { //조리개값
$xxx = explode("/", $v);
$FNumber = $xxx[0] / $xxx[1];
$info['FNumber'] = "F".$FNumber;
} else if ($k == "ExposureTime") { //셔터 속도
$xxx = explode("/", $v);
$ExposureTime = $xxx[1] / $xxx[0];
$info['ExposureTime'] = "1/".$ExposureTime."s";
} else if ($k == "FocalLength") { //초점 거리
$xxx = explode("/", $v);
$FocalLength = $xxx[0] / $xxx[1];
$info['FocalLength'] = $FocalLength."mm";
}
}
return $info;
}