전체 게시판의 이미지 뽑아오기 질문입니다. 정보
전체 게시판의 이미지 뽑아오기 질문입니다.첨부파일
본문
첨부파일은 모든 게시판에서 첨부되어있는 모든 사진을 추출하는 최근 게시물 스킨입니다.
몇가지 옵션으로 추출을 제외할 게시판등을 지정할 수가 있는데요..
이 스킨은 하나의 게시물에 두장의 이미지가 있다면 두장의 이미지를 모두 추출합니다.
까막눈으로 보니...
bf_file 을 모두 뿌려주는 것 같은데요..
이 스킨을 이용해서 그누보드에 첨부된 이미지중 각 게시물의 첫번째 이미지만 뽑아 오려면 어떻게 해야 하나요?
파일 다운 받기 귀찮은 분들을 위해 아래에 코드를 적습니다.
까막눈으로 봐도 아마 아래 코드중 빨간 색 부분이 전체 이미지를 불러오는 부분같습니다.
이부분을 $list[$i][file][0][file] 이 처럼 하면 않되네요..
고수님들의 도움을 부탁 드립니다.
-------------------------------------------------------------------------------------------
<?
include_once("./_common.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$g4[title] = "특정게시판 내 이미지를 보여줍니다.";
include_once("$g4[path]/_head.php");
////////////////basic cf control///////////
$g4[g4_board_file] = "g4_board_file";
$one_rows = "24"; // 이미지 출력수량
$width_o = "120"; //이미지 가로값
$height_o = "100"; //이미지 세로값
$cols = "6"; // 이미지 가로갯수
$image_h = "17"; // 이미지 상하 간격
//뽑고자하는 게시판의 jpg, jpeg, gif, png 파일만 검색한다.
//20090602 onuri.nanzoa.com 다양한 조건 추가
//뽑고자하는 게시판 ... || bo_table='02_1' 여러개 추가가능....
//또는 제외시키고자하는 게시판 || bo_table != '09_1' 등등 조건을 다양하게 줄 수 있음.
//단 아래 읽기권한 제외시에는 and 삭제 예) $one_like = " bo_table='02_1' ";
$one_like = " and bo_table='02_1' ";
//게시판 읽기권한 조건을 제외하고 이미지를 다 보여주고자 한다면 아래 $mem_like 주석처리
//$mem_like 후 아래 $one_count_sql, $one_sql 조건문의 $mem_like 삭제
$mem_like = " bo_table IN (select bo_table from `$g4[board_table]` where bo_read_level <= '$member[mb_level]') ";
//AND bf_file LIKE '%jpg' or bf_file LIKE '%jpeg' or bf_file LIKE '%gif' or bf_file LIKE '%png' 간단히 줄임
$two_like = " and bf_file LIKE '%jpg' or '%jpeg' or '%gif' or '%png' ";
$one_count_sql = " select count(*) as cnt from $g4[g4_board_file] where $mem_like $one_like $two_like ";
$row = sql_fetch($one_count_sql);
$total_count = $row[cnt];
$total_page = ceil($total_count / $one_rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $one_rows; // 시작 열을 구함
$to_record = $from_record + $one_rows ;
$one_sql = " select * from $g4[g4_board_file] where $mem_like $one_like $two_like order by bf_datetime desc limit $from_record, $one_rows";
$one_result = sql_query($one_sql);
?>
<!-----------기간별 출력시작--------->
<table width='100%' cellpadding='0' cellspacing='0'>
<tr><td height="10"></td></tr>
<tr><td align='left'><font style="padding-left:5px;font-size:12px;"><b>이미지</b> (총 <?=$total_count?>개중 <?=$from_record+1?> -
<?
if (($from_record + ($one_rows-1)) < $total_count) {
echo "{$to_record}";
} else {
echo "{$total_count}";
}
?>)
</font>
</td></tr>
<tr><td height="10"></td></tr>
<tr><td height='1' bgcolor='#E7E7E7'></td></tr>
<tr><td height="10"></td></tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<?//출력
for ($i=0; $one_row = sql_fetch_array($one_result); $i++){
if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
if ($one_row[bf_width] > $one_row[bf_height]) {
$width_i1 = $width_o;
$height_i1 = ($one_row[bf_height] * $width_o) / $one_row[bf_width] ;
if ($height_i1 > $height_o) {
$width_i = ($width_i1 * $height_o) / $height_i1;
$height_i = $height_o;
} else {
$width_i = $width_i1;
$height_i = $height_i1;
}
} else if ($one_row[bf_width] < $one_row[bf_height]) {
$width_i = ($one_row[bf_width] * $height_o) / $one_row[bf_height];
$height_i = $height_o;
} else {
$width_i = $height_o;
$height_i = $height_o;
}
?>
<td valign='top' align="center" width="150">
<table width="140" height="120" border="0" cellpadding="0" cellspacing="0" bgcolor='#ECECEC' onMouseOver="bgColor='#71AEFE'" onMouseOut="bgColor='#ECECEC'">
<tr><td align="center"><table bgcolor="#FFFFFF" width="136" height="116" border="0" cellpadding="0" cellspacing="0">
<tr><td align="center"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$one_row[bo_table]?>&wr_id=<?=$one_row[wr_id]?>' onfocus='this.blur()'><img src="<?=$g4[path]?>/data/file/<?=$one_row[bo_table]?>/<?=$one_row[bf_file]?>" border="0" width='<?=$width_i?>' height='<?=$height_i?>' title="사이즈 : <?=$one_row[bf_width]?> x <?=$one_row[bf_height]?> "></a></td></tr>
</table></td></tr>
</table>
<table width='140' cellpadding='0' cellspacing='0'><tr><td height="5"></td></tr><tr><td align="left">
<?
$sql = " select wr_subject from $g4[write_prefix]$one_row[bo_table] where wr_id = '$one_row[wr_id]' ";
$row = sql_fetch($sql);
$sql2 = " select bo_subject from $g4[board_table] where bo_table = '$one_row[bo_table]' ";
$row2 = sql_fetch($sql2);
?>
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$one_row[bo_table]?>&wr_id=<?=$one_row[wr_id]?>' onfocus='this.blur()'><b><u><?=cut_str($row[wr_subject], 16)?></u></a></td></tr>
<tr><td height="5"></td></tr>
<tr><td align="left"> <?=$row2[bo_subject]?></td></tr>
</table>
</td>
<? } ?>
</tr>
<tr><td width="150" height="10"></td><td width="150" height="10"></td><td width="150" height="10"></td><td width="150" height="10"></td><td width="150" height="10"></td></tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr><td height='1' bgcolor='#E7E7E7'></td></tr>
<tr><td height="10"></td></tr>
<tr><td>
<?
$page = get_paging($config[cf_write_pages], $page, $total_page, "?&page=");
echo "$page";
?>
</td></tr>
<tr><td height="10"></td></tr>
</table>
<?
include_once("$g4[path]/_tail.php");
?>
댓글 전체
==>
$one_sql = " select * from $g4[g4_board_file] where bf_no=0 and $mem_like $one_like $two_like order by bf_datetime desc limit $from_record, $one_rows";
^___________________________^