그누4 첨부파일이 있을 땐, 첨부파일이 썸네일로 출력

그누4 첨부파일이 있을 땐, 첨부파일이 썸네일로 출력

QA

그누4 첨부파일이 있을 땐, 첨부파일이 썸네일로 출력

본문

그누4 홈페이지입니다.

플래시가 만료되면서 스마트에디트로 바꾸는 방법을 찾지 못해 

파일첨부로 사진을 올리고 있는데요..

현재는 기존에 사진첨부로 첨부했던 이미지가 썸네일로 출력됩니다. 

첨부파일이 있을 때는 첨부파일이, 그게 아닐땐 사진첨부로 첨부한 파일이

썸네일로 나오게 하고싶습니다.

소스는 아래와 같습니다. 

형광펜 표시 해놓은 부분을 수정하면 될거같은데.. 어떻게 해야할까요 

 

 

<?

function get_editor_image($contents, $view=true)

{

if(!$contents)

return false;

// $contents 중 img 태그 추출

if ($view)

$pattern = "/<img([^>]*)>/iS";

else

$pattern = "/<img[^>]*src=[\'\"]?([^>\'\"]+[^>\'\"]+)[\'\"]?[^>]*>/";

preg_match_all($pattern, $contents, $matchs);

return $matchs;

}​

 

?>

 

<?

for ($i=0; $i<count($list); $i++)

{

$editor_thum_img_arr = get_editor_image($list[$i]['wr_content'], false);

$title = "자세히보기";

$content = cut_str(get_text($list[$i][wr_content]), 80);

$subject = cut_str(get_text($list[$i][subject]), 30, '...'); //제목길이

$img_width = '250'; // 이미지 가로크기

$img_height = '150'; // 이미지 세로크기

 

$img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);

if (!file_exists($img) || !$list[$i][file][0][file])

$img = "$board_skin_path/img/noimage.jpg";

$href = "$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}";

$view_href = "$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}";

 

if ($list[$i][wr_id] != 14){

$editor_thum_img = $editor_thum_img_arr[1][0];

}

else{

$editor_thum_img = $editor_thum_img_arr[1][1];

}

 

 

(중략)

 

echo <<<HEREDOC

<td width="{$td_width}%" valign="top" align="center">

<table border="0" cellpadding="0" cellspacing="0">

<tr>

<td style='word-break:break-all; padding-bottom:8px;'><a href="{$href}"><img src="{$editor_thum_img}" width='{$img_width}' border="0" title="$title" style="border:1px solid #ccc"></a></td>

HEREDOC;

 

 

(중략)

 

?>

이 질문에 댓글 쓰기 :

답변 1

if ($list[$i][wr_id] != 14){

$editor_thum_img = $editor_thum_img_arr[1][0];

}

else{

$editor_thum_img = $editor_thum_img_arr[1][1];

}

 

$img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);

if (!file_exists($img)) {

  $img = $editor_thum_img;

if (!file_exists($img)) {

  $img = "$board_skin_path/img/noimage.jpg";

}

$href = "$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}";

$view_href = "$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}";

 

<img src="{$img}" ~~

 

답변을 작성하시기 전에 로그인 해주세요.
전체 123,639 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT