파일이름의 확장자로 파일 종류를 확인하는 함수 입니다.

· 10년 전 · 1558

파일이름의 확장자로 파일 종류를 확인하는 함수입니다.
미디어스킨 또는 이미지 관련스킨에 유용할듯해서 올립니다.


function file_type($filename)
{
      $tmp = explode(".", $filename);
      $ext = trim($tmp[count($tmp)-1]);

      $type_image = "jpg|jpeg|gif|bmp|pcx|png";
      $type_compress = "zip|alz|gz|tar|z|rar|ace|bz|bz2";
      $type_text = "txt|text|rtf|2b";
      $type_html = "htm|html";
      $type_hwp = "hwp|h30";
      $type_exe = "exe";
      $type_font = "ttf";
      $type_movie = "avi|mpg|mpeg|mqv|asf|wmv|mov";
      $type_sound = "wav|mp3|mid|wma";

      if(preg_match("/($type_image)/i",$ext))
              $file_type = 'image';
      else if(preg_match("/($type_compress)/i",$ext))
              $file_type = 'compress';
      else if(preg_match("/($type_text)/i",$ext))
              $file_type = 'text';
      else if(preg_match("/($type_html)/i",$ext))
              $file_type = 'html';
      else if(preg_match("/($type_hwp)/i",$ext))
              $file_type = 'hwp';
      else if(preg_match("/($type_exe)/i",$ext))
              $file_type = 'exe';
      else if(preg_match("/($type_font)/i",$ext))
              $file_type = 'font';
      else if(preg_match("/($type_movie)/i",$ext))
              $file_type = 'movie';
      else if(preg_match("/($type_sound)/i",$ext))
              $file_type = 'sound';
      else
              $file_type = 'unknown';

      return $file_type;
}  

|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
10년 전 조회 1,575
10년 전 조회 1,622
10년 전 조회 1,593
10년 전 조회 1,648
10년 전 조회 1,664
10년 전 조회 1,639
10년 전 조회 1,797
10년 전 조회 1,792
10년 전 조회 1,594
10년 전 조회 1,891
10년 전 조회 2,219
10년 전 조회 1,672
10년 전 조회 1,943
10년 전 조회 1,902
10년 전 조회 1,751
10년 전 조회 1,729
10년 전 조회 1,662
10년 전 조회 1,769
10년 전 조회 1,526
10년 전 조회 1,608
10년 전 조회 1,827
10년 전 조회 1,650
10년 전 조회 1,596
10년 전 조회 1,598
10년 전 조회 1,603
10년 전 조회 1,640
10년 전 조회 1,625
10년 전 조회 1,637
10년 전 조회 1,594
10년 전 조회 1,767
10년 전 조회 1,567
10년 전 조회 1,593
10년 전 조회 1,707
10년 전 조회 2,379
10년 전 조회 1,649
10년 전 조회 1,625
10년 전 조회 1,703
10년 전 조회 1,608
10년 전 조회 1,784
10년 전 조회 1,699
10년 전 조회 1,620
10년 전 조회 1,605
10년 전 조회 1,642
10년 전 조회 1,648
10년 전 조회 1,570
10년 전 조회 1,519
10년 전 조회 1,506
10년 전 조회 1,537
10년 전 조회 1,950
10년 전 조회 1,559
10년 전 조회 1,675
10년 전 조회 1,606
10년 전 조회 1,848
10년 전 조회 1,667
10년 전 조회 1,575
10년 전 조회 1,617
10년 전 조회 1,650
10년 전 조회 1,761
10년 전 조회 1,709
10년 전 조회 1,594
10년 전 조회 1,628
10년 전 조회 2,589
10년 전 조회 2,461
10년 전 조회 2,014
10년 전 조회 2,588
10년 전 조회 1,649
10년 전 조회 2,055
10년 전 조회 2,291
10년 전 조회 1,798
10년 전 조회 1,729
10년 전 조회 1,701
10년 전 조회 1,568
10년 전 조회 1,740
10년 전 조회 1,750
10년 전 조회 2,253
10년 전 조회 1,672
10년 전 조회 1,762
10년 전 조회 1,737
10년 전 조회 2,655
10년 전 조회 1,800
10년 전 조회 1,673
10년 전 조회 1,774
10년 전 조회 1,783
10년 전 조회 1,863
10년 전 조회 1,671
10년 전 조회 1,759
10년 전 조회 2,094
10년 전 조회 2,037
10년 전 조회 2,003
10년 전 조회 1,569
10년 전 조회 1,659
10년 전 조회 1,621
10년 전 조회 1,579
10년 전 조회 1,801
10년 전 조회 1,580
10년 전 조회 1,885
10년 전 조회 1,563
10년 전 조회 1,898
10년 전 조회 1,597
10년 전 조회 1,824