vmv파일의 가로 세로의 크기를 읽어오는 함수가 있나요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

vmv파일의 가로 세로의 크기를 읽어오는 함수가 있나요? 정보

vmv파일의 가로 세로의 크기를 읽어오는 함수가 있나요?

본문

글쓰기에서 파일첨부로 파일 올리면
vmv파일은 가로 세로 값이 0으로 db에 저장됩니다

이렇게되니까 글읽기에서 wmv파일은
300x200으로 나타났다가 새로고침 몇번 해보면
원싸이즈로 나타났다가 지멋대로 나오는군요

사진같은것은 getimagesize로 잘 읽어내는데
동영상은 그렇게 안되는군요
다 그럴건데...

고수님들 write_update.php 보시고 답변좀부탁드립니다






write_update.php 일부입니다
.
.

 $upload[$i][image] = @getimagesize($dest_file);
.
.
.
.
// 가변 파일 업로드
// 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.
for ($i=0; $i<count($upload); $i++)
{
    $row = sql_fetch(" select count(*) as cnt from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
    if ($row[cnt])
    {
        // 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
        // 그렇지 않다면 내용만 업데이트 합니다.
        if ($upload[$i][del_check] || $upload[$i][file])
        {
            $sql = " update $g4[board_file_table]
                        set bf_source = '{$upload[$i][source]}',
                            bf_file = '{$upload[$i][file]}',
                            bf_content = '{$bf_content[$i]}',
                            bf_filesize = '{$upload[$i][filesize]}',
                            bf_width = '{$upload[$i][image][0]}',
                            bf_height = '{$upload[$i][image][1]}',
                            bf_type = '{$upload[$i][image][2]}',
                            bf_datetime = '$g4[time_ymdhis]'
                      where bo_table = '$bo_table'
                        and wr_id = '$wr_id'
                        and bf_no = '$i' ";
            sql_query($sql);
        }
        else
        {
            $sql = " update $g4[board_file_table]
                        set bf_content = '{$bf_content[$i]}'
                      where bo_table = '$bo_table'
                        and wr_id = '$wr_id'
                        and bf_no = '$i' ";
            sql_query($sql);
        }
    }
    else
    {
        $sql = " insert into $g4[board_file_table]
                    set bo_table = '$bo_table',
                        wr_id = '$wr_id',
                        bf_no = '$i',
                        bf_source = '{$upload[$i][source]}',
                        bf_file = '{$upload[$i][file]}',
                        bf_content = '{$bf_content[$i]}',
                        bf_download = 0,
                        bf_filesize = '{$upload[$i][filesize]}',
                        bf_width = '{$upload[$i][image][0]}',
                        bf_height = '{$upload[$i][image][1]}',
                        bf_type = '{$upload[$i][image][2]}',
                        bf_datetime = '$g4[time_ymdhis]' ";
        sql_query($sql);
    }
  • 복사

댓글 전체

php 내장 함수는 아니고 동영상파일의 width와 height를 구할 수 있는 라이브러리를 구현한
사이트가 있더군요 getid3라는 라이브러리인데 http://getid3.sourceforge.net 에 가시면
받으실 수 있습니다. 사용법은

include_once('getid3.php'); // or wherever you actually put the getid3 scripts
$file_location = './myvideo.avi';
$file_info = GetAllFileInfo($file_location) // calls getid3 function
$file_width = $file_info['video']['resolution_x'];
$file_height = $file_info['video']['resolution_y'];

이런식으로 적용시키더군요

제가 알고 있던 내용은 아니고 gd 라이브러리에 동영상 사이즈를 구하는게 있나 살펴보다가
php 사이트에 User Contributed Notes 를 보다가 발견했습니다.

출처 - http://us3.php.net/getimagesize
© SIRSOFT
현재 페이지 제일 처음으로