리스트(gblist.skin.php)에서 최신이미지 하나만 보려면(12시간째 눈팅만...) > 그누3질답

그누3질답

리스트(gblist.skin.php)에서 최신이미지 하나만 보려면(12시간째 눈팅만...) 정보

그누보드 리스트(gblist.skin.php)에서 최신이미지 하나만 보려면(12시간째 눈팅만...)

본문

그누가족이면 다 아시는 40대초짜 플록입니다.
갤러리형 보드의 리스트에서 썸네일을 클릭하면 해당글의 1번첨부 이미지를 리스트의 정해진 자리에 스크린샷으로 보이게 하고, 그 스크린샷을 클릭하면 해당이미지의 원본파일 크기로 팝업해서 보여지게 하려고 합니다.
문제는...
처음 게시판을 들어왔을때 스크린샷이 올라올자리에 아래 처럼 처리해서 최신등록 이미지를 불러오려니 엉뚱한(마지막에서 4번째) 이미지가 올라옵니다.
참고  http://www.songga.co.kr/?doc=bbs/gnuboard.php&bo_table=catalog_2
에서 보시고 조언좀 해주시면 고맙겠습니다.

해당 부분의 소스입니다.(고수님들의 소스를 짜깁기해서 어느분의 소스인지도 헷갈리네요,,)
원본 소스를 수정한 곳은 없구요.
gblist.skin.php 파일에서 스크린샷이 올라올 자리에..
<?//스크린샷위치에 업로드파일 로드
for ($i=0; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>

<form name=f><input type=hidden name=dnimg value='<?=$list[$i][file1]?>'></form>
<table width='100%' cellpadding=0 cellspacing=0 border=0 style='TABLE-LAYOUT: fixed;'>
<tr>
<td width=''>&nbsp;</td>
<td width='300' align='center' valign='top' style='border-width:5px; border-color:#EEEEEE; border-style:solid;'>
<img name=gallery_img value=0 src='<?=$list[$i][file1]?>' width='<?=$thum_WH?>' height='<?=$thum_HG?>' border='0' onClick="openDnWnd();" style='cursor:hand' alt='원본이미지보기'></td>
<td width=''>&nbsp;</td>
</tr>
</table>



============================================================================
아래는 참고로 gblist.skin.php 파일 전체내용입니다.
============================================================================
<?
include_once $board_skin."/_include.php";

$thum_WH &nbsp;= 300; // 이미지 폭
$thum_HG = 420; // 이미지 높이
?>

<script language="JavaScript">
<!--
function bluring(){
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;
// -->
</script>

<script>
 &nbsp;function chgImg( imgname, dnimgname, imgdesc ) {
 &nbsp; &nbsp;var LureExp = /<br>/gi;
 &nbsp; &nbsp;document.gallery_img.src=imgname;
 &nbsp; &nbsp;document.f.dnimg.value=dnimgname;
 &nbsp; &nbsp;document.descForm.desc.value=imgdesc.replace( LureExp, "\n" );
 &nbsp;}
 &nbsp;function openDnWnd() {
 &nbsp; &nbsp;window.top.open( '<?=$board_skin?>/gallery_wnd.php?gallery_img=' + document.f.dnimg.value, 'lure', 'width=300 height=300 resizable status');
 &nbsp;}
</script>
<META http-equiv="imagetoolbar" content="no">

<!-- 타이틀 -->
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<form name=fcategory>
<td width=30%>
<?=$show_category_begin?>
<select name=ca_id onchange="location='<?=$category_location?>'+this.value;" class=s_select>
<option value=''>++갤러리 바로가기++</option>
<?=$category_option?>
</select>
<?=$show_category_end?>
</td> </form>
<td width=40% align=center><span class=subject><a href="../">메인</a>&nbsp;>&nbsp;<?=$board[bo_subject]?></span></td>
<td width=30% align=right><span class=s_etc2>등록사진: <?=$total_count?></span>
<?=$show_admin_begin?><?=$a_admin_link?><?=$show_admin_end?></td>
</tr>
</table>

<table width=100% border=0 cellpadding=2 cellspacing=0>
<form name=frmgblist method='post' action='gbdeleteall.php'>
<tr>
<td height=3 bgcolor=#DADADA>
<input type=hidden name=bo_table value='<?=$bo_table?>'>
<input type=hidden name=sselect &nbsp;value='<?=$sselect?>'>
<input type=hidden name=stext &nbsp; &nbsp;value='<?=$stext?>'>
<input type=hidden name=section &nbsp;value='<?=$section?>'>
<input type=hidden name=page &nbsp; &nbsp; value='<?=$page?>'>
</td>
</tr>
<tr><td height=1 bgcolor=#DADADA></td></tr>
<tr><td height=10 class=list1></td></tr>
<tr><td height=1 bgcolor=#E7E7E7></td></tr>
<tr><td height=5 bgcolor=ffffff></td></tr>
</form>
</table>

<!-- 목록 시작 -->
<table cellpadding="0" cellspacing="0" width="<?=$width?>" style='border-width:1px; border-color:#EEEEEE; border-style:solid;'>
<tr>
<td width="500" align="left" valign="top">
<?//스크린샷위치에 업로드파일 로드
for ($i=0; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
<!-- 이미지 레이어 -->
<table border=0 cellspacing=0 cellpadding=0 width="100%" height="100%" align="center">
<form name=f><input type=hidden name=dnimg value='<?=$list[$i][file1]?>'></form>
<tr>
<td width='10'>&nbsp;</td>
<td class='padding20'></td>
<td width='10'>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center" valign="middle">
<table width='100%' cellpadding=0 cellspacing=0 border=0 style='TABLE-LAYOUT: fixed;'>
<tr>
<td width=''>&nbsp;</td>
<td width='300' align='center' valign='top' style='border-width:5px; border-color:#EEEEEE; border-style:solid;'>
<img name=gallery_img value=0 src='<?=$list[$i][file1]?>' width='<?=$thum_WH?>' height='<?=$thum_HG?>' border='0' onClick="openDnWnd();" style='cursor:hand' alt='원본이미지보기'></td>
<td width=''>&nbsp;</td>
</tr>
</table>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td class=copyright align=center><!-- Copyright &copy; you. all rights reserved. --></td>
<td>&nbsp;</td>
</tr>
</table>

</td>
<td align="right" valign="bottom">
<!-- 텍스트 레이어+썸네일 -->
<table border=0 cellspacing=0 cellpadding=0 width="100%" height="100%" align="center">
<tr>
<td width=''>&nbsp;</td>
<td class='padding20'>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="center" valign="middle">
<table border=0 cellspacing=0 cellpadding=0 width="300" height="100%" align="center" style='border-width:1px; border-color:#EEEEEE; border-style:solid;'>
<form NAME="descForm">
<tr valign=middle>
<td align="right">
<!--textarea 의 크기를 수정해 주세요 cols는 넓이 rows는 줄수 -->
<textarea name="desc" cols="60" rows="8" class='s_textarea' readonly>
▒ 아래 섬네일을 클릭하면 좌측에 스크린샷 이미지가 나옵니다.
 &nbsp; &nbsp;또한 이 위치로 내용이 올라옵니다.
▒ 스크린샷 이미지를 클릭하면 실제 크기의 이미지가 열립니다.
▒ 제목을 클릭하면 상세한 내용을 볼 수 있습니다.</textarea>
</td>
</tr>
</form>
</table>

</td>
<td>&nbsp;</td>
</tr>
<tr height=14>
<td></td>
<td>

<!-- 여기부터 반복 부분 -->
<table width='100%' align=center cellpadding=3 border=0 >
<tr>
<? &nbsp;
for ($i=0; $i<count($list); $i++) {

$tr = "";
if ($i && $i%$board[bo_gallery_width]==0) {
$tr = "</tr><tr>";
}
echo "$tr";

//if (!file_exists($list[$i][file_image1])) { $list[$i][file_image1] = "$board_skin/noimage.gif"; }

//################################
$ori = $list[$i][file_image1]; //[필수](URL) "./img/Test.gif"
$ext = strtolower(substr(strrchr($ori,"."), 1)); //확장자

//if ( file_exists($ori) ) $ori_info=getimagesize($ori); else $ori_info=""; //파일이 있을 경우, 확장자 지정.
if ( $ext=="gif"||$ext=="jpg"||$ext=="jpeg"||$ext=="png"||$ext=="bmp"||$ext=="tif"||$ext=="tiff") $ori_info=getimagesize($ori); else $ori_info="";

if ( $ori_info[2]=="2" || $ori_info[2]=="3" ) { // 원파일이 [ 2JPG, 2JPEG, 3PNG ] 경우.

$thum = $ori.".Thum" ;
if ( file_exists($thum) ) { // Thumbnail [O] 경우

$thum_info = getimagesize ($thum);
$thum_W = $thum_info[0] ;
$thum_H = $thum_info[1] ;

} else { // Thumbnail [X] 경우

if ( smaller( $ori_info[0], $ori_info[1] ) ) {

maker( $thum_W, $thum_H );
}
}

} else if ( $ori_info[2]=="1" || $ori_info[2]=="6" || $ori_info[2]=="7" ) { // 원파일이 [ 1GIF,6BMP,7TIF ] 경우.

if ( smaller( $ori_info[0], $ori_info[1] ) ) {

$thum = $ori ;
}

} else { // 원파일이 [ 1,2,3,6,7 ] 아닐 경우.

$thum = $noIMG ;
$noIMG_info = getimagesize ($noIMG);
$thum_W = $noIMG_info[0] ;
$thum_H = $noIMG_info[1] ;
}

//################################

?>

<td width='<?=$td_width?>%' valign=top align=center>

<table !bgcolor=silver cellpadding=0 cellspacing=0 border=0>
<tr>
<td !align=center !valign=middle !bgcolor=#F2F4F4 >
<a href=# <? echo "onClick=\"chgImg( '".$list[$i][file_image1]."','".$list[$i][file_image1]."','".ereg_replace("(\r\n|\n|\r)", "<br>", strip_tags($list[$i][content]) )."' );\"" ?>><img src='<?=$thum?>' width='<?=$thum_W?>' height='<?=$thum_H?>' style='border-color:#A5A5A5;' border=0></a></td>
<td width=4 background='<?=$board_skin?>/sdw_R.gif' ></td>
</tr>
<tr>
<td height=4 background='<?=$board_skin?>/sdw_B.gif' ></td>
<td background='<?=$board_skin?>/sdw_RB.gif' ></td>
</tr>
</table>

<table height=5 cellspacing=0 ><tr><td></td></tr></table>
<a href='<?=$list[$i][href]?>'><? if ($list[$i][is_notice]) echo "<b>"; ?><?=cut_str($list[$i][subject],$str,"…");?></a> <?=$list[$i][icon_new]?><? if ($list[$i][is_notice]) echo "</b>"; ?>
<span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span>
</td>
<? }
if (count($list) == 0) { echo "<tr><td colspan=8 align=center height=100 class='content contentbg'>자료가 없습니다.</td></tr>"; }
 
?>

<!-- </form> -->
</table>

</td>
</tr>
</table>
<!-- 여기까지 반복 부분/ -->

</td>
<td></td>
</tr>
</table>
<!-- 텍스트 레이어+썸네일 -->
<!-- 목록 끝/ -->

<!-- 플러그인 quickGo -->
<table align="center" border="0" cellpadding="0" cellspacing="0" width="<?=$width?>">
<tr><td colspan=2 height=1 bgcolor=#DADADA></td></tr>
<tr><td colspan=2 height=3 class=list1></td></tr>
<tr>
<td width="500" align=center class='list1 copyright'>&nbsp;</td>
<td class=list1>
<!-- 플러그인 quickGo -->
<table width=100% height=100% cellpadding=2 cellspacing=0 border=0>
<tr>
<td align=right>
<!--Board quick-->
<script language='JavaScript'>
<!--
function change1(form) {
if(form.url.options[form.url.selectedIndex].value != "")
//window.open(form.url.options[form.url.selectedIndex].value) //새창
location.href=form.url.options[form.url.selectedIndex].value //현재창
}
//-->
</script>

<form name=quickgo>
<select name=url onChange=change1(this.form) size=0 STYLE="font-family:굴림; font-size:9pt; color:#000000; background-color:#FFFFFF; border-width:0; border-color:#eeeeee;">

<?
$sqlgr = " select * from $cfg[table_group] order by gr_id ";
$resgr = sql_query($sqlgr);
while ($rowgr = mysql_fetch_array($resgr)) {
echo " <option> $rowgr[gr_subject] </option>";
$sqlbo = " select * from $cfg[table_board] where gr_id = '$rowgr[gr_id]' order by bo_table ";
$resbo = sql_query($sqlbo);
while ($rowbo = mysql_fetch_array($resbo)) {
echo " <option value='$cfg[bbs_dir]/gnuboard.php?bo_table=$rowbo[bo_table]'> $rowbo[bo_subject]</option>";
}
mysql_free_result($resbo);
}
mysql_free_result($resgr);
?>
</select>
</td>
</tr></form>
</table>
<!-- 플러그인 quickGo end -->
</td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#E7E7E7></td></tr>
<tr><td colspan=2 height=5 bgcolor=ffffff></td></tr>
</table>
<!-- 플러그인 quickGo /-->

<table align="center" border="0" cellpadding="0" cellspacing="0" width="<?=$width?>">
<tr><td colspan=3 height=1 background='./<?=$cfg[bbs_dir]?>/line.gif'></td></tr>
<tr><td colspan=3 height=5 bgcolor=ffffff></td></tr>
<tr>
<td width=33% class='padding10'>
<? if ($list_href) { echo "<a href='$list_href'>목록</a>"; } ?>
<? if ($write_href) { echo "<a href='$write_href'>새이미지 등록</a>"; } ?>
</td>
<td width=34% align=center>
<? if ($prev_section_href) { echo "<a href='$prev_section_href'>이전검색</a>"; } ?>
<?=$write_pages?>
<? if ($next_section_href) { echo "<a href='$next_section_href'>다음검색</a>"; } ?>
</td>
<form name=fsearch method=get action='./'>
<input type=hidden name=doc value='<?=$doc?>'>
<input type=hidden name=bo_table value='<?=$bo_table?>'>
<td width=33% align=right>
<select name=sselect class=select>
<option value='wr_subject|wr_content'>제목+내용</option>
<option value='wr_name'>이름</option>
<option value='wr_num'>번호</option>
<option value='wr_datetime'>날짜</option>
<option value='wr_subject'>제목</option>
<option value='wr_content'>내용</option>
<option value='wr_hit'>읽음</option>
<? if ($is_good) { ?><option value='wr_good'>추천</option><? } ?>
<? if ($is_nogood) { ?><option value='wr_nogood'>비추천</option><? } ?>
</select><input type=text name=stext size=10 required itemname='검색어' value='<?=$stext?>' class=input><input type=submit value='검색' class=button>&nbsp;</td>
</tr>
</form>
</table>

<? if ($stext) { ?>
<script language='JavaScript'>
if ('<?=$sselect?>' == 'ca_id') {
document.fcategory.ca_id.value = '<?=$stext?>';
document.fsearch.stext.value = '';
} else {
document.fsearch.sselect.value = '<?=$sselect?>';
}
</script>
<? } ?>

읽어주셔서 감사합니다.
  • 복사

댓글 전체

© SIRSOFT
현재 페이지 제일 처음으로