웹마스터 팁

<?php

// 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);
  $exif_makernote = read_exif_data($imagePath ,'MAKERNOTE' ,'UndefinedTag');

//MAKERNOTE.UndefinedTag:0x0095: EF24-70mm f/2.8L II USM   

      //error control
      $notFound = "Unavailable";
      
      // Makernote 
      if (@array_key_exists('UndefinedTag', $exif_makernote)) {
        $camMakenote = $exif_makernote['UndefinedTag'];
      } else { $exif_makernote = $notFound; }
//$return['makernote'] = $camMakernote;
      // 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; }

      // Date2
      if (@array_key_exists('DateTimeOriginal', $exif_exif)) {
        $camDate2 = $exif_exif['DateTimeOriginal'];
      } else { $camDate2 = $notFound; }

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

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

//FocalLength
      if (@array_key_exists('FocalLength', $exif_exif)) {
        $camFocal = $exif_ifd0['FocalLength'];
      } else { $camFocal = $notFound; }


//Height
      if (@array_key_exists('Height', $exif_ifd0['COMPUTED'])) {
  $camHeight = $exif_ifd0['COMPUTED']['Height'];
      } else { $camHeight = $notFound; }

//Widht
      if (@array_key_exists('Width', $exif_ifd0['COMPUTED'])) {
  $camWidth = $exif_ifd0['COMPUTED']['Width'];
      } else { $camWidth = $notFound; }

      $return = array();
      $return['make'] = $camMake;
      $return['model'] = $camModel;
  $return['makernote'] = $camMakernote;
      $return['exposure'] = $camExposure;
      $return['aperture'] = $camAperture;
      //$return['date'] = $camDate; //파일날자
      $return['iso'] = $camIso;
  $return['soft'] = $camSoft;
  $return['focal'] = $camFocal;
  $return['height'] = $camHeight;
  $return['width'] = $camWidth;
  $return['date2'] = $camDate2;
      return $return;
    


    } else {
      return false; 
    } 
}
?>
<include target="/home/hosting_users/******/www/_data/exif/exif.php" />
{@
$imagePath=$file->uploaded_filename;
$img_size=getimagesize($imagePath);
$file_size=filesize($imagePath);
$file_size3=number_format($file_size);
$camera = cameraUsed($imagePath);
//echo "사용기종 : " . $camera['make'] . " " . $camera['model'] . " | ";
echo "사용기종 : " . $camera['model'] . " | ";
//echo "사용렌즈 : " . $camera['makernote'] . " | ";
echo "노출시간 : " . $camera['exposure'] . " | ";
echo "조리개 : " . $camera['aperture'] . " | ";
echo "ISO : " . $camera['iso'] . " | ";
echo "초점거리 : " . $camera['focal'] . " | ";
//echo "Software : " . $camera['soft'] . " | ";
echo "촬영일자 : " . $camera['date2'] . " | ";
//echo "해상도 : ".$camera['width'] ."x". $camera['height'];
echo "해상도 : ".$img_size[0]."x".$img_size[1]." px" . " | ";
//echo $img_size[3];
echo "파일크기 : ".$file_size3." byte";
//return FileSizeConvert($imagePath);
}

exif 출력 애드온이 제대로 작동하지않길래 php.net 에서 샘플을 긁어오고 살을 조금붙여서 사용하고있습니다.
잘 작동하네요 ^^

 

태그 연관 글
  1. [2010/11/22] 묻고답하기 도와주세요 ㅠ..ㅠ ; DQ_LIBS/include 폴더에서 파일하나를 삭제했는데 by 하나비839
제목 글쓴이 날짜
플래시메뉴 사입방법 [4] urhow1 2007.08.29
분류가 있는 게시판에서 전체분류모드로 게시물 클릭시 딜레이 현상 [2] Sx3 2007.08.30
페이지수정 안되시는 분들께 드리는 팁 [2] 다케루 2007.08.30
구글광고넣기....(재밌는경험담 본문에 광고 넣으시려는분 꼭 읽어 보세요...) [2] kangho 2007.08.30
회원 단축 메뉴 보여주기 file Simulz 2007.08.30
(최근글목록) 분류명 표시하기 & 이미지 [7] Simulz 2007.08.31
서버이전하고 마이그레이션하고 경험담 [3] 팔공산 2007.08.31
(최근글목록) 게시판 이름 출력하기 #2 [12] file Simulz 2007.08.31
관리자 아이디 사용제한 체크하는 어이없는 실수 & 해결 [5] refree 2007.09.01
(0.1.2) 이모티콘 삽입 후 그림 안보일 때 [5] Simulz 2007.09.02
랜덤 배경 이미지 [7] Simulz 2007.09.04
(설문조사) 회원만 설문 조사 하도록 [8] Simulz 2007.09.04
회원에게는 구글 애드센스 보이지 않게 하기 [2] 스컬리지금어디야 2007.09.05
글이 중간에 짤릴 경우.. 송암 2007.09.06
확장변수 이용해서 2차 3차 분류 항목 만들기 [3] VagaBond 2007.09.08
(게시판) 목록에 확장 변수를 출력하기 [18] file Simulz 2007.09.08
메인 페이지 링크 www. 주소 표시, 로그인 링크 문제.... [5] 마덴나 2007.09.08
(파일 첨부) 파일명 안보일 때 ... 없애기 [9] Simulz 2007.09.10
랭킹에 순위 넣기! ㅋ~ (꼼수;) file 다케루 2007.09.11
파일 업로드시에 403에러 발생시 해결방법. [12] WhiteAT 2007.09.12