그룹최신글에서 이미지노출문제,.. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

그룹최신글에서 이미지노출문제,.. 정보

그룹최신글에서 이미지노출문제,..

본문

lib파일을 만들어서(사실은 퍼와서 ㅋ)넣고 그룹최신글을 추출했는데요
이상하게도 다른건 정상인데 이미지 경로가 틀리네요..
그것도 한군데가 틀리는데 일단 lib 파일 소스 올립니다...
----------------------
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출 - 선택한 그룹별로 원하는 수만큼 보여줌
function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="")
{
    global $config;
    global $g4;
$list = array();
$limitrows = $rows;
$sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' and  bo_use_search=1 order by bo_order_search";
$rsgroup = sql_query($sqlgroup);
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
for ($j=0, $k=0; $rowgroup=sql_fetch_array($rsgroup); $j++) {
$bo_table = $rowgroup[bo_table];
// 테이블 이름구함
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 실제이름
// 옵션에 따라 정렬
$sql = "select * from $tmp_write_table where wr_is_comment = 0 ";
$sql .= (!$category) ? "" : " and ca_name = '$category' ";
$sql .= (!$orderby) ? "  order by wr_id desc " : "  order by $orderby desc, wr_id desc ";
$sql .= " limit $limitrows";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++, $k++) {
if(!$orderby) $op_list[$k] = $row[wr_datetime];
else  {
$op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);
$op_list[$k] .= $row[wr_datetime];
}
$list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);
}
}
if($k>0) array_multisort($op_list, SORT_DESC, $list);
if($k>$rows) array_splice($list, $rows);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
} ?>
-------------------------
최신글에 포함된 원 이미지 경로가
./data/file/n_08/2034593677_a5ef416c_1257825.jpg 일경우
./data/file/(추출그룹의 맨 마지막 게시판 ID)/2034593677_a5ef416c_1257825.jpg
이렇게 나오네요... 그래서 계속 이미지가 오류로 나옵니다..
 
저는 그룹최신글 스킨에서
-----------
<?               
  echo "<a href='{$list[$k][href]}'>";
             $image = urlencode($list[$k][file][0][file]);
          if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
        echo "<img src='$g4[path]/data/file/$bo_table/$image' width='$image_width' height='$image_height'  border=3 style='border-color:EFEFEF;' align=left>"; 
             } else
         if (file_exists($list[$k][file_image1])) { $gznews_img = "width='$image_width' height='$image_height' border=3 style='border-color:EFEFEF;' align=left>"; }
  ?>
-------------
이부분중 이미지경로에 표시되어있는 $bo_table를 다르게 정해주어야 되지 않겠나
생각해봤는데 잘 모르겠네요....
 
아시는 분 계시면 도움 부탁드립니다...
  • 복사

댓글 전체

lib 파일에서

$list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);

위 라인 바로 아래에 아래의 코드를 한줄 추가한후

$list[$k][bo_table] = $board[bo_table];


스킨에서 아래처럼 해보세요.

<?               
  echo "<a href='{$list[$k][href]}'>";
            $image = urlencode($list[$k][file][0][file]);
          if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
        echo "<img src='$g4[path]/data/file/{$list[$k][bo_table]}/$image' width='$image_width' height='$image_height'  border=3 style='border-color:EFEFEF;' align=left>";
            } else
        if (file_exists($list[$k][file_image1])) { $gznews_img = "width='$image_width' height='$image_height' border=3 style='border-color:EFEFEF;' align=left>"; }
  ?>
© SIRSOFT
현재 페이지 제일 처음으로