썸네일질문여!

썸네일질문여!

QA

썸네일질문여!

본문

갤러리 썸네일 출력하려고 하는데

첨부파일말고 내용에서 입력시(content) 내용에 입력된 첫번째 사진이 썸네일 출력되게 하는 방법이 있을까요?

이 질문에 댓글 쓰기 :

답변 2

thumbnail.lib.php 안에 보시며 

get_list_thumbnail 라는 함수가 있습니다.

 

특정 게시판만 위 조건을 거시려면 if($bo_table=="테이블명"){ 해서 조건을 걸어주셔야 하고

게시판 상관없이 사이 전체적으로 적용하실꺼면


    if($row['bf_file']) {
        $filename = $row['bf_file'];
        $filepath = G5_DATA_PATH.'/file/'.$bo_table;
        $alt = get_text($row['bf_content']);
    } else {
        $write_table = $g5['write_prefix'].$bo_table;
        $sql = " select wr_content from $write_table where wr_id = '$wr_id' ";
        $write = sql_fetch($sql);
        $matches = get_editor_image($write['wr_content'], false);
        $edt = true;
 
        for($i=0; $i<count($matches[1]); $i++)
        {
            // 이미지 path 구함
            $p = parse_url($matches[1][$i]);
            if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
                $data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
            else
                $data_path = $p['path'];
 
            $srcfile = G5_PATH.$data_path;
 
            if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
                $size = @getimagesize($srcfile);
                if(empty($size))
                    continue;
 
                $filename = basename($srcfile);
                $filepath = dirname($srcfile);
 
                preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
                $alt = get_text($malt[1]);
 
                break;
            }
        }
    }
 
//해당 부분을
 
 
 
        $write_table = $g5['write_prefix'].$bo_table;
        $sql = " select wr_content from $write_table where wr_id = '$wr_id' ";
        $write = sql_fetch($sql);
        $matches = get_editor_image($write['wr_content'], false);
        $edt = true;
 
        for($i=0; $i<count($matches[1]); $i++)
        {
            // 이미지 path 구함
            $p = parse_url($matches[1][$i]);
            if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
                $data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
            else
                $data_path = $p['path'];
 
            $srcfile = G5_PATH.$data_path;
 
            if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
                $size = @getimagesize($srcfile);
                if(empty($size))
                    continue;
 
                $filename = basename($srcfile);
                $filepath = dirname($srcfile);
 
                preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
                $alt = get_text($malt[1]);
 
                break;
            }
        }
 
    if(!$filename && $row['bf_file']) {
        $filename = $row['bf_file'];
        $filepath = G5_DATA_PATH.'/file/'.$bo_table;
        $alt = get_text($row['bf_content']);
    }
 

이렇게 변경해주세요

그누에 기본 썸네일이 파일이고 파일이 없으면 내용에서 가져옵니다. 그 썸네일 부분 함수를 확인하셔서 체크 순서를 바꾸시면 될거 같습니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 332
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT