뷰페이지 썸네일 출력시 첫번째 이미지가 처음에 출력되게끔 하고싶어요

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
뷰페이지 썸네일 출력시 첫번째 이미지가 처음에 출력되게끔 하고싶어요

QA

뷰페이지 썸네일 출력시 첫번째 이미지가 처음에 출력되게끔 하고싶어요

본문

http://csms.co.kr/bbs/board.php?bo_table=98&wr_id=1

첨부파일로 이미지를 여러장 올릴때 뷰페이지 왼쪽 상단에 큰 썸네일이 나오는데 
가장 아래쪽에 올린 이미지가 맨 처음 페이지 떴을때 나오더라구요  지금 화면으로는 꽃이미지가 나오죠 
썸네일 리스트중에 왼쪽에 텍스트로 된 이미지가 출력되게끔 하고 싶어요 
처음에 올린 이미지가 화면에 표시되게끔 하고 싶은데 방법이 없을까요 .. 


<SCRIPT LANGUAGE='JavaScript'>

// 이미지뷰어

<!-- 

    var win= null;

    function View_Open(img, w, h)

    {

        var winl = (screen.width-w)/2;

        var wint = (screen.height-h)/3;

        var settings  ='height='+h+',';

            settings +='width='+w+',';

            settings +='top='+wint+',';

            settings +='left='+winl+',';

            settings +='scrollbars=yes,';

            settings +='resizable=yes,';

            settings +='status=no';




        win=window.open("","newWindow",settings);

        win.document.open(); 

        win.document.write ("<html><head><title>원본 이미지 보기</title></head>"); 

        win.document.write ("<script>function init(){window.resizeBy(document.all.pop_img.width-document.body.clientWidth, document.all.pop_img.height-document.body.clientHeight+10);}</script>"); 

        win.document.write ("<body bgcolor=white topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 oncontextmenu='return false' ondragstart='return false' onkeydown='return false' onselectstart='return false' onload='init();'>");

        win.document.write ("<img src='"+img+"' border=0 onclick='window.close();' style='cursor:hand' title='닫기' id='pop_img'>");

        win.document.write ("</body></html>");

        win.document.close();

    }

//-->

</SCRIPT>




<SCRIPT LANGUAGE="JavaScript">

<!-- 

image_directory = "";   //배경이미지 경로

clear = new Image();  clear.src = image_directory + "./img/blank.gif";

<?

//파일 뽑기

$sql2 = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 10 "; 

$result2 = sql_query($sql2);

for ($j=0; $row2 = sql_fetch_array($result2); $j++) {

$view_one = "{$g4['path']}/data/file/{$bo_table}/{$row2['bf_file']}";




?>

view_img<?=$j?> = new Image();

view_img<?=$j?>.src = "<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$row2['bf_file']?>";

<? } ?>

function bgChange(imgName) { 

	document.all.view_img.src = eval(imgName + ".src");

}

//  -->

</SCRIPT>




<table width=100% cellspacing="0" cellpadding="0" border="0" align="center">

<tr>

	<td width="5"></td>

    <td style="padding:4 0 4 0px;" width="350" height="350" align="center" valign="top"> 

    <div style='width:350px; position:relative; overflow:hidden;' align=center><a href="javascript:void(0);" onClick="View_Open('<?=$view_one?>')"><img src="<?=$view_one?>" name="view_img" border="5" width=330 height=330 style="border-color:#161616;"></a></div>

    </td>

	<td width="10"></td>

    <td style="padding:4 0 4 0px;" width="400" height="330" align="center" valign="top"> 




	<table id="Table_01" width="400" height="138" border="0" cellpadding="0" cellspacing="0">

	<tr>

		<td colspan="2"><img src="<?=$board_skin_path?>/img/product_01.gif" width="250" height="12" alt=""></td>

	</tr>

	<tr>

		<td><?php echo($view[wr_3]); ?></td>

        <td width="280" height="28"><p align="left"><b><font color="#669900"><span style="font-size:24pt;"><?php echo($view[subject]); ?></span></font></b></p></td>

	</tr>

	<tr>

		<td colspan="2"><img src="<?=$board_skin_path?>/img/product_04.gif" width="250" height="4" alt=""></td>

	</tr>

	<tr>

		<td><img src="/images/list_bt_01.jpg"><b><span style="font-size:13pt;"> 중     량 :</span></b></td>

        <td width="280" height="28"><p align="center"><font color="#666666"><span style="font-size:11pt;"><?php echo($view[wr_7]); ?> g</span></font></p></td>

	</tr>

    <tr>

		<td colspan="2"><img src="<?=$board_skin_path?>/img/product_07.gif" width="250" height="4" alt=""></td>

	</tr>

	<tr>

		<td><img src="/images/list_bt_02.jpg"> <b><span style="font-size:13pt;">주 원 료 :</span></b></td>

        <td width="280" height="28"><p align="center"><font color="#666666"><span style="font-size:11pt;"><?php echo($view[wr_8]); ?></span></font></p></td>

	</tr>

	<tr>

		<td colspan="2"><img src="<?=$board_skin_path?>/img/product_07.gif" width="250" height="4" alt=""></td>

	</tr>

	<tr>

		<td><img src="/images/list_bt_03.jpg"> <b><span style="font-size:13pt;">입     상 :</span></b></td>

        <td width="280" height="28"><p align="center"><font color="#666666"><span style="font-size:11pt;"><?php echo($view[wr_9]); ?></span></font></p></td>

	</tr>

    <tr>

		<td colspan="2"><img src="<?=$board_skin_path?>/img/product_07.gif" width="250" height="4" alt=""></td>

	</tr>

	<tr>

		<td><img src="/images/list_bt_04.jpg"> <b><span style="font-size:13pt;">출시년도 :</span></b></td>

        <td width="280" height="28"><p align="center"><font color="#666666"><span style="font-size:11pt;"><?php echo($view[wr_10]); ?> 년</span></font></p></td>

	</tr>

    <tr>

		<td colspan="2"><img src="<?=$board_skin_path?>/img/product_07.gif" width="250" height="4" alt=""></td>

	</tr>




	<tr>

		<td colspan="2">

		

		<?

//파일 뽑기

$sql = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 10 "; 

$result = sql_query($sql);

for ($i=0; $row = sql_fetch_array($result); $i++) {




//썸네일 코드 시작

$data_path = $g4['path'] . "/data/file/{$bo_table}";//라이브러리 파일 참조

$thumb_path = $data_path . '/thumbOpen';




$view_w = 110; //썸네일 가로사이즈

$view_h = 110; //썸네일 세로사이즈

$sch_q = 100; //썸네일 퀼리티




if (!is_dir($thumb_path)) {

@mkdir($thumb_path, 0707);

@chmod($thumb_path, 0707);

}

    $filename = $row[bf_file]; //파일명

    $thumb = $thumb_path.'/'.$filename; //썸네일

    if (!file_exists($thumb))

    {

	$file = $data_path.'/'.$filename; //원본

        if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file))

        {

            $size = getimagesize($file);

            if ($size[2] == 1)

                $src = imagecreatefromgif($file);

            else if ($size[2] == 2)

                $src = imagecreatefromjpeg($file);

            else if ($size[2] == 3)

                $src = imagecreatefrompng($file);

            else

                continue;




            $rate = $view_w / $size[0];

            $height = (int)($size[1] * $rate);




            if ($height < $view_h)

                $dst = imagecreatetruecolor($view_w, $height);

            else

                $dst = imagecreatetruecolor($view_w, $view_h);

            imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);

            imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);

            chmod($thumb_path.'/'.$filename, 0707);

        }

    }




	if (file_exists($thumb) && $filename) {

?>

<a href="javascript:void(0);" onClick="View_Open('<?=$data_path?>/<?=$filename?>')" onMouseOver="bgChange('view_img<?=$i?>');" onMouseOut="bgChange('view_img<?=$i?>');"><img src='<?=$thumb?>' border=1 width=95 height=95 style="border-color:#d5d5d5;"></a> <?

//onMouseOut="bgChange('clear');"

}

}

?>

		

		</td>

	</tr>

	</table>




    </td>

	<td width="5"></td>

</tr>

</table>



 

이 질문에 댓글 쓰기 :

답변 2

//파일 뽑기
037 $sql2 " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 10 ";

37번쨰 줄에 있는 윗 구문을 아래처럼 해보세요.
않되도 돌던지기 없김돠..;;

$sql2 " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no desc limit 0, 10 ";

빨간 부분의 desc 를 추가해보세요.
답변을 작성하시기 전에 로그인 해주세요.
전체 0
QA 내용 검색
  • 개별 목록 구성 제목 답변작성자조회작성일
  • 질문이 없습니다.

회원로그인

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