2026, 새로운 도약을 시작합니다.

최신글에서 썸네일생성시 질문드립니다. 채택완료

https://sir.kr/g5_tip/2410

위 팁을이용해서 리스트페이지에서 첨부파일 모두를 썸네일로 생성했습니다.

최신글에서도 리스트처럼 썸네일을 생성해야하는데 원본주소를 가져오지못하는지 썸네일생성이 안되네요.

원래 최신글에서 첨부파일 전체를 사용할수없는건지 궁금하네요.

thumbnail.lib에 추가한 코드입니다.

Copy


// 게시글리스트 전체 썸네일 생성

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

{

    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 $option, 1 ";

    $row = sql_fetch($sql);

    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$src, "ori"=>$ori, "alt"=>$alt);

    return $thumb;

}

latest.skin.php 최신글 스킨에 적용한 코드입니다.

Copy

답변 1개

최신글을 불러오는 페이지가 index.php 인가요?

일반적으로 thumbnail.lib.php 파일을 인클루드 하지 않거든요.

추가로 인클루드 해주셔야 합니다.

아래 소스를 index.php 에 추가해보세요.

include_once(G5_LIB_PATH.'/thumbnail.lib.php');

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

thumbnail.lib.php는 최신글 스킨에서 인클루드해둔상태라 썸네일 생성에는 문제가없습니다. 문제는 첨부파일 1번은 썸네일 생성이 잘 되는데 2번부터는 원본주소를 못 불러오는듯하네요..;;

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

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

로그인
🐛 버그신고