p

view_skin.php 파일 내용입니다. 첫번째 올린 이미지가 먼저 나오게 하려면요?

제품소개 스킨을 적용했는데 가장 나중에 올린 이미지가 먼저 뜹니다
 
이미지 업로드 할때 제일 먼저 등록한 이미지가 먼저 보이게 하려면
 
무엇을 수정해야 할까요?
 
==============  초반생략  ====================
 
<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>
 
==============================================================================
 
 
|

댓글 4개

$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 ";
를 다음과 같이 수정해주세요.
$sql2 = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_datetime limit 0, 10 ";
<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_datetime 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="590" cellspacing="0" cellpadding="0" border="0" align="center">
<tr height="5">
<td colspan="5"></td>
</tr>
<tr height="10">
<td colspan="5"></td>
</tr>
<tr>
<td width="5"></td>

<td style="padding:4 0 4 0px;" width="450" height="300" align="center" valign="top">
<div style='width:400px; height:400px; position:relative; overflow:hidden;' align=center><img src="<?=$view_one?>" name="view_img" border="0"></a></div>
</td>
<td width="10"></td>

<td style="padding:4 0 4 0px;" width="160" height="300" align="center" valign="top">
<?
//파일 뽑기
$sql = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_datetime 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 = 100; //썸네일 가로사이즈
$view_h = 100; //썸네일 세로사이즈
$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=0></a>
<p>
<?
//onMouseOut="bgChange('clear');"
}
}
?>


이렇게 했는데도 안됩니다
마지막에 올린 이미지가 먼저 보여지네요
$sql2 = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_datetime limit 0, 10 ";
=>
$sql2 = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_datetime
asc limit 0, 10 ";
$sql2 = " select bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_datetime
desc limit 0, 10 ";

이렇게 하니까 되네요^^ 감사합니다
댓글을 작성하시려면 로그인이 필요합니다.

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

+
제목 글쓴이 날짜 조회
07-10-18 조회 1,623
07-10-18 조회 1,342
07-10-18 조회 1,663
07-10-18 조회 1,585
07-10-17 조회 3,336
07-10-17 조회 1,039
07-10-17 조회 1,055
07-10-17 조회 1,622
07-10-17 조회 1,262
07-10-17 조회 1,025
07-10-17 조회 1,026
07-10-17 조회 1,206
07-10-17 조회 906
07-10-17 조회 897
07-10-17 조회 1,000
07-10-17 조회 1,731
07-10-17 조회 2,870
07-10-17 조회 1,294
07-10-17 조회 997
07-10-17 조회 1,032