웹마스터 팁

<?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
제목 글쓴이 날짜
EXIF 메타정보 필요하신 분 있으시면 forest535 2018.04.09
게시판 본문읽기에서 컨텐츠 이미지와 텍스트 분리하여 출력하기 forest535 2018.04.09
관리권한 없이도 특정그룹에게 비밀글 열람 및 댓글작성 권한 부여하는 방법 ( 부운영자등을 위해) sejin7940 2018.04.26
[PHP] 이름 및 연락처 마스킹 처리 [1] ppumweb 2018.05.21
단축url API 사용하시는 분들... 미스터강 2018.06.01
게시판글 엑셀 파일 보내기 php7용 file 황금날개 2018.06.05
도메인 변경 또는 설치 폴더 변경시 이미지 주소변경하기 file 해피정닷컴 2018.06.08
XE용 CKEditor v4.9.2 (다크 스킨 수정) [4] file 큰돌♡ 2018.07.04
DB를 손쉽게 관리 [1] EISOFT 2018.07.15
Code-Highlighter 3.0.83 가로 스크롤바를 어디론가 보내 버리고 싶으신 분. 달빛늑대 2018.07.16
Google 스프레드시트에서 구글 번역으로 XE 다국어 내용 만들기(Lang.xml 용도) file 달빛늑대 2018.07.17
act로 다른 페이지 보여주기 [1] 이온디 2018.07.25
다른 서버 간 서브도메인 쿠키 공유 에이트 2018.08.04
썸네일 방식으로 이미지 원본 주소 가져오기 에이트 2018.08.22
PHP 뮤텍스 락 설치법(memcached 활용) [1] 에이트 2018.09.03
PHP 뮤텍스 락 설치법(redis 활용) 에이트 2018.09.11
무료 psd, html 탬플릿, 아이콘 사이트공유합니다. 허허길드짱 2018.11.27
file 모듈 insertFile() manual_insert 시 디렉토리생성 에러 문제 해결 방법 onTrust 2019.01.02
트윗버튼, 페어스북 좋아요 버튼, 카카오스토리 좋아요 버튼 태그 elancer 2019.03.11
무료이미지 다운 받을 수 있는 곳 elancer 2019.03.19