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

두번째 첨부파일을 썸네일로 출력하는법 채택완료

식물성식용유 4년 전 조회 3,492

https://sir.kr/qa/293932

 

위의 방법으로 해보려고했는데

lib/thumbnail.lib.php 파일의 function get_list_thumbnail 함수 내용이 전혀 달라

어디를 수정해야할지 모르겠습니다..

 

</p>

<p>// 게시글리스트 썸네일 생성

function get_list_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')

{

    global $g5, $config;

    $filename = $alt = $data_path = '';

    $edt = false;</p>

<p>    $row = get_thumbnail_find_cache($bo_table, $wr_id, 'file');

    $empty_array = array('src'=>'', 'ori'=>'', 'alt'=>'');</p>

<p>    if(isset($row['bf_file']) && $row['bf_file']) {

        $filename = $row['bf_file'];

        $filepath = G5_DATA_PATH.'/file/'.$bo_table;

        $alt = get_text($row['bf_content']);

    } else {

        $write = get_thumbnail_find_cache($bo_table, $wr_id, 'content');

        $edt = true;

        

        if( $matches = get_editor_image($write['wr_content'], false) ){

            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'];</p>

<p>                $srcfile = G5_PATH.$data_path;</p>

<p>                if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {

                    $size = @getimagesize($srcfile);

                    if(empty($size))

                        continue;</p>

<p>                    $filename = basename($srcfile);

                    $filepath = dirname($srcfile);</p>

<p>                    preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);

                    $alt = isset($malt[1]) ? get_text($malt[1]) : '';</p>

<p>                    break;

                }</p>

<p>                $filename = run_replace('get_editor_filename', $filename, $p);

            }   //end for

        }   //end if

    }</p>

<p>    if(!$filename)

        return $empty_array;

    

    if( $thumbnail_info = run_replace('get_list_thumbnail_info', array(), array('bo_table'=>$bo_table, 'wr_id'=>$wr_id, 'data_path'=>$data_path, 'edt'=>$edt, 'filename'=>$filename, 'filepath'=>$filepath, 'thumb_width'=>$thumb_width, 'thumb_height'=>$thumb_height, 'is_create'=>$is_create, 'is_crop'=>$is_crop, 'crop_mode'=>$crop_mode, 'is_sharpen'=>$is_sharpen, 'um_value'=>$um_value)) ){

        return $thumbnail_info;

    }</p>

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

<p>    if($tname) {

        if($edt) {

            // 오리지날 이미지

            $ori = G5_URL.$data_path;

            // 썸네일 이미지

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

        } else {

            $ori = G5_DATA_URL.'/file/'.$bo_table.'/'.$filename;

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

        }

    } else {

        return $empty_array;

    }</p>

<p>    $thumb = array("src"=>$src, "ori"=>$ori, "alt"=>$alt);</p>

<p>    return $thumb;

}

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

답변 1개

채택된 답변
+20 포인트
4년 전

$row = get_thumbnail_find_cache($bo_table, $wr_id, 'file');

->

//$row = get_thumbnail_find_cache($bo_table, $wr_id, 'file');

$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 1, 1 "; $row = sql_fetch($sql);

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

답변에 대한 댓글 1개

식물성식용유
4년 전
추가해주면 되는거였군요 답변 감사합니다ㅜㅜㅜㅜ!!!!

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

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

로그인