테스트 사이트 - 개발 중인 베타 버전입니다

latest skin 이용 시, 채택완료

피드빽 11년 전 조회 4,857

갤러리형식으로 해서 대표이미지를 불러오는데요,

 

항상 1번대표이미지를 불러오더라구요, 근데 저는 2번 대표이미지를 불러오고싶은데

 

어떻게 수정을 해야 하나요? 보니깐, 썸네일만드는과정에서 바꾸어야하는것같은데

 

get_list_thumbnail 부분에서 어디를 건드려야 될지 모르겠습니다 ㅜㅜ

 

function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_create=false, $is_crop=true, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3')

{

    global $g5, $config;

    $filename = $alt = "";

    $edt = false;

 

    $sql = " select bf_file, bf_content from {$g5['board_file_table']}

                where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_type between '1' and '3' order by bf_no limit 0, 1 ";

    $row = sql_fetch($sql);

 

    if($row['bf_file']) get_list_thumbnail{

        $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;

            }

        }

    }

 

    if(!$filename)

        return false;

 

    $tname = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, $is_create, $is_crop, $crop_mode, $is_sharpen, $um_value);

 

    if($tname) {

        if($edt) {

            $src = G5_URL.str_replace($filename, $tname, $data_path);

        } else {

            $src = G5_DATA_URL.'/file/'.$bo_table.'/'.$tname;

        }

    } else {

        return false;

    }

 

    $thumb = array("src"=>$src, "alt"=>$alt);

 

    return $thumb;

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

답변 1개

채택된 답변
+20 포인트
f
11년 전
팁게시판에선가 본 듯 합니다.
로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

피드빽
11년 전
어디요?ㅜㅜ
f
fm25
11년 전
http://sir.co.kr/bbs/board.php?bo_table=g5_tip&wr_id=1915

적용해보지는 않았습니다.
스크랩을 해 두지 않아... 찾기가 어려웠네요.

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

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

로그인