자동글쓰기 썸네일 화면이 안나오네요.

자동글쓰기 썸네일 화면이 안나오네요.

QA

자동글쓰기 썸네일 화면이 안나오네요.

답변 1

본문

게시판에 자동글쓰기를 이용해서 글을 업로드 시키면 본문에서는 그림이 잘나오는데

목록썸네일에는 안나오더라구요 목록 썸네일에도 나오게 하려면 어떻게 해야 할까요?

 

 

 

<?php

define('_INDEX_', true);

include_once('./_common.php');



//ver1.0 150414 @_untitle_d



function insert_write($newpost)

{

global $g5;


//게시판 테이블 정보

$bo_table = $newpost[bo_table];

if(!strlen($bo_table)) return FALSE; //bo_table 값이 지정되지 않았습니다.

$board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '$bo_table' ");

if(!$board) return FALSE; //bo_table이 존재하지 않습니다.

//회원정보 및 권한 확인

    $member = get_member($newpost[mb_id]);

    if(!$member) return FALSE; //mb_id가 존재하지 않습니다.

    //if($board[bo_write_level] > $member[mb_level]) return FALSE; //글쓰기 권한이 없습니다.

//카테고리 설정

    $ca_name = $newpost[ca_name];

if ($ca_name && strpos($board[bo_category_list], $ca_name) === FALSE){

$category_list = $board[bo_category_list]."|".$ca_name;

$sql = " update {$g5['board_table']} set bo_category_list = '$category_list' where bo_table = '$bo_table' ";

sql_query($sql);

}


//변수 정리

    $write_table = $g5[write_prefix].$bo_table;

    $wr_num = get_next_num($write_table);

    $ca_name = addslashes($ca_name);

    $html = "html1";

    $secret = "";

    $mail = "";

    $wr_subject = addslashes(trim($newpost[wr_subject]));

    $wr_content = addslashes(trim($newpost[wr_content]));

    if(!$wr_subject) return FALSE; //글 제목이 없습니다.

    if(!$wr_content) return FALSE; //글 내용이 없습니다.

    $mb_id = $member[mb_id];

    $wr_password = $member[mb_password];

    $wr_name = $board[bo_use_name] ? $member[mb_name] : $member[mb_nick];

$wr_email = $member[mb_email];

$wr_homepage = $member[mb_homepage];

    for($i=1; $i<=10; $i++){

        $wr = "wr_{$i}";

        ${$wr} = addslashes($newpost[$wr]);

    }

    $wr_link1 = $newpost[wr_link1];

    $wr_link2 = $newpost[wr_link2];

//글 입력하기

$sql = " insert into $write_table

                set wr_num = '$wr_num',

                     wr_reply = '',

                     wr_comment = 0,

                     ca_name = '$ca_name',

                     wr_option = '$html,$secret,$mail',

                     wr_subject = '$wr_subject',

                     wr_content = '$wr_content',

                     wr_link1 = '$wr_link1',

                     wr_link2 = '$wr_link2',

                     wr_link1_hit = 0,

                     wr_link2_hit = 0,

                     wr_hit =  '" . rand(100, 200) . "',

                     wr_good = 0,

                     wr_nogood = 0,

                     mb_id = '$mb_id',

                     wr_password = '$wr_password',

                     wr_name = '$wr_name',

                     wr_email = '$wr_email',

                     wr_homepage = '$wr_homepage',

                     wr_datetime = '".G5_TIME_YMDHIS."',

                     wr_last = '".G5_TIME_YMDHIS."',

                     wr_ip = '{$_SERVER['REMOTE_ADDR']}',

                     wr_1 = '$wr_1',

                     wr_2 = '$wr_2',

                     wr_3 = '$wr_3',

                     wr_4 = '$wr_4',

                     wr_5 = '$wr_5',

                     wr_6 = '$wr_6',

                     wr_7 = '$wr_7',

                     wr_8 = '$wr_8',

                     wr_9 = '$wr_9',

                     wr_10 = '$wr_10' ";

    sql_query($sql);

    

    $wr_id = sql_insert_id();


    sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); //부모 아이디에 UPDATE

sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '$mb_id' ) "); //새글 INSERT    

    sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}' "); //게시글 1 증가

return array('bo_table' => $bo_table, 'wr_id' => $wr_id, 'sca' => $ca_name);

//return TRUE;

}



//$newpost[mb_id], $newpost[bo_table], $newpost[wr_subject], $newpost[wr_content] 값만 지정하고,

//insert_write($newpost); 라고 실행시키면 글이 해당 게시판에 올라갑니다.


$timg = array('/img/1.png', '/2.png');


$ttitle = array('1', '2', '3');


$ttitle_cnt = sql_fetch(" select tp_cnt from tp_title_cnt ");

if (count($ttitle) > $ttitle_cnt['tp_cnt'])

sql_query(" update tp_title_cnt set tp_cnt = tp_cnt + 1 ");

if (count($ttitle) == ($ttitle_cnt['tp_cnt']+1))

sql_query(" update tp_title_cnt set tp_cnt = 0 ");




$newpost = array(

'mb_id' => 'admin',

'bo_table' => 'freeboard',

'wr_subject' => $ttitle[$ttitle_cnt['tp_cnt']],

'wr_content' => "<span style='font-size:14pt;'>자동글쓰기</span><br><br><img src='".$timg[rand()%count($timg)]."'>"

);

$result = insert_write($newpost);



?>


<a href="<?=G5_BBS_URL?>/board.php?bo_table=<?=$result[bo_table]?>&wr_id=<?=$result[wr_id]?>&sca=<?=$result[sca]?>">결과보기</a>

 

이 질문에 댓글 쓰기 :

답변 1

list.skin.php 최상단부분에

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

 

 

을 추가해주세요.

 

목록에서 이미지를 출력할 부분에

 


<td class="td_image" style="width:<?php echo $board['bo_gallery_width'] ?>px; height:<?php echo $board['bo_gallery_height'] ?>px;">
                <a href="<?php echo $list[$i]['href'] ?>">
                <?php
                if ($list[$i]['is_notice']) { // 공지사항  ?>
                    <strong style="width:<?php echo $board['bo_gallery_width'] ?>px;height:<?php echo $board['bo_gallery_height'] ?>px">공지</strong>
                <?php } else {
                    $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
                    if($thumb['src']) {
                        $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
                    } else {
                        $img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px">no image</span>';
                    }
                    echo $img_content;
                }
                 ?>
                </a>
            </td>

를 넣어주세요.

 

저는 <td class="td_chk">...</td><?php } ?> 밑 부분에 넣었습니다. 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 35
© SIRSOFT
현재 페이지 제일 처음으로