view_skin.php 파일 내용입니다. 첫번째 올린 이미지가 먼저 나오게 하려면요? 정보
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']}";
?>
<!--
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>
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>
==============================================================================
댓글 전체
$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 ";
를 다음과 같이 수정해주세요.
$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');"
}
}
?>
이렇게 했는데도 안됩니다
마지막에 올린 이미지가 먼저 보여지네요
<!--
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
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 ";
이렇게 하니까 되네요^^ 감사합니다
desc limit 0, 10 ";
이렇게 하니까 되네요^^ 감사합니다