채택완료

썸네일질문여!

2017-04-11 (화) 17:11:44 4,146

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

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

답변 2개

채택된 답변
+20 포인트

thumbnail.lib.php 안에 보시며 

get_list_thumbnail 라는 함수가 있습니다.

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

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

Copy
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']);    }

이렇게 변경해주세요

2017-04-11 (화) 17:14:28

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

답변을 작성하려면 로그인이 필요합니다.