노이미지 나오게 수정좀...부탁해요

· 2011-01-13 (목) 19:04:07 · 1682 · 10
<?
$g4_path = "../../../";
include_once("$g4_path/common.php");
include_once("$board_skin_path/config.php");

// 파일 출력
$sql = "select * from $g4[board_file_table] where `bo_table`='$bo_table' and `wr_id`='$wr_id'";
$result=mysql_query($sql);
for($i=0 ; $row = mysql_fetch_array($result) ; $i++){
$img[$i]="$g4[path]/data/file/$bo_table/$row[bf_file]";
}
?>
<script language="JavaScript">
<!--
function transimg(place) {
if (place==1) dare.src="<?=$img[0]?>";
if (place==2) dare.src="<?=$img[1]?>";
if (place==3) dare.src="<?=$img[2]?>";
if (place==4) dare.src="<?=$img[3]?>";
if (place==5) dare.src="<?=$img[4]?>";
if (place==6) dare.src="<?=$img[5]?>";
if (place==7) dare.src="<?=$img[6]?>";
if (place==8) dare.src="<?=$img[7]?>";
if (place==9) dare.src="<?=$img[8]?>";
if (place==10) dare.src="<?=$img[9]?>";
}
// -->
</script>
  <b>[상품 이미지 상세보기]</b>
<table cellpadding="0" cellspacing="0" width="851" height="498">
<tr>
<td width="650" 547">
<table cellpadding="0" cellspacing="0" width="650" height="498">
<tr>
<td width="10" height="10">
</td>
<td width="640" height="10">
</td>
</tr>
<tr>
<td width="10">
<p> </p>
</td>
<td width="640">
<img src="<?=$img[0]?>" width="640" height="480" style='border:1 solid #cccccc;' name=dare>
</td>
</tr>
</table>
</td>
<td width="1"> </td>
<td width="200" height=498 valign=top>
<table cellpadding="0" cellspacing="0" width="200">
<tr>
<td width="9" height="10">
</td>
<td width="191" height="10">
</td>
</tr>
<tr>
<td width="9" height="409">
<p> </p>
</td>
<td width="191" height="409" valign=top>

<table cellpadding="0" cellspacing="0" width="190">
<tr>
<td width="90" height="90"><span style="cursor:hand" onMouseOver="transimg(1)"><img src="<?=$img[0]?>" width="90" height="70" style='border:1 solid #cccccc;'></span></td>
<td width="8" height="90"> </td>
<td width="92" height="90"><span style="cursor:hand" onMouseOver="transimg(2)"><img src="<?=$img[1]?>" width="90" height="70" style='border:1 solid #cccccc;'></span></td>
</tr>
<tr>
<td width="90" height="8"></td>
<td width="8" height="8"></td>
<td width="92" height="8"></td>
</tr>
<tr>
<td width="90" height="90"><span style="cursor:hand" onMouseOver="transimg(3)"><img src="<?=$img[2]?>" width="90" height="70" style='border:1 solid #cccccc;'></span></td>
<td width="8" height="90"> </td>
<td width="92" height="90"><span style="cursor:hand" onMouseOver="transimg(4)"><img src="<?=$img[3]?>" width="90" height="70" style='border:1 solid #cccccc; onerror="this.src=''" >
</span></td>
</tr>
<tr>
<td width="90" height="8"></td>
<td width="8" height="8"></td>
<td width="92" height="8"></td>
</tr>
</table>

</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="850" cellpadding="0" cellspacing="0">
<tr>
<td width="850" valign="middle" align="center" height="30"><a href="javascript:window.close()" onfocus=blur()><img src="<?=$board_skin_path?>/img/close.jpg" border="0"></a></td>
</tr>
</table>


게시판 뷰 페이지에서 첨부이미지 클릭하면 새창으로 이미지 나오는 소스인데요.
노이미지가 설정이 안되서 부탁드립니다....첨부파일에 이미지 1개만 올리면 3개가 엘박으로 나오거든요 무저건4개로 설정이 되어있어요...설정을 올린거만 뜨게해도 좋은데...부탁좀 드립니다.
|

댓글 10개

function transimg(place) {
// 추가
if (!place) dare.src="노이미지주소";

if (place==1) dare.src="<?=$img[0]?>";
if (place==2) dare.src="<?=$img[1]?>";
if (place==3) dare.src="<?=$img[2]?>";
if (place==4) dare.src="<?=$img[3]?>";
if (place==5) dare.src="<?=$img[4]?>";
if (place==6) dare.src="<?=$img[5]?>";
if (place==7) dare.src="<?=$img[6]?>";
if (place==8) dare.src="<?=$img[7]?>";
if (place==9) dare.src="<?=$img[8]?>";
if (place==10) dare.src="<?=$img[9]?>";
}
// 추가
if (!place) dare.src="<img src='$board_skin_path/img/noimage.gif' align=absmiddle>";

이렇게 했는데 안되네여...
어떻게 해야될까요.
죄송합니다^^; 저때문에 쪽지보내셔서 포인트나 까먹게 만들고 ㅠㅠㅠ

(1) 번의 항목위치에 (2)와 같이 추가해줍니다^^;;

(1) 원본
------------------------------------------------------
for($i=0 ; $row = mysql_fetch_array($result) ; $i++){
$img[$i]="$g4[path]/data/file/$bo_table/$row[bf_file]";
}

(2) 변경
------------------------------------------------------
for($i=0 ; $row = mysql_fetch_array($result) ; $i++){
$img[$i]=($row[bf_file])?"$g4[path]/data/file/$bo_table/$row[bf_file]":"노이미지주소만";
}


제가 짐작해서 해드리는거라 번거로우시더라도 정상작동되는지 확인하시어서 답글달아주세요 ㅎㅎ
안되네요.ㅎㅎ
으음... 혹시 누가 안되신다면, 원격으로 봐드릴까요^^;;
주소는 이런식으로 했어요...
http://sir.co.kr/skin/board/ggaggungisik/img/btn_choice.gif
2011-01-13 (목) 23:01:25
이미지 출력부분에 if 문으로 감싸서 없다면 noimg 출력을 유도하면될것 같네요
2011-01-14 (금) 00:34:27
for($i=0 ; $row = mysql_fetch_array($result) ; $i++){
$img[$i]="$g4[path]/data/file/$bo_table/$row[bf_file]";
}

for(; $i<4; $i++)
$img[ $i]= '노이미지 경로';
2011-01-14 (금) 07:54:05
익스만을 고려한다면 onError를 사용해서도 가능합니다.
답변 정말 고맙습니다~~
엔피씨님이 수정해 주셔서 해결하였습니다. 고맙습니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

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

+
제목 글쓴이 날짜 조회
11-01-14 조회 1,192
11-01-14 조회 1,665
11-01-14 조회 968
11-01-14 조회 2,869
11-01-14 조회 867
11-01-14 조회 2,496
11-01-14 조회 1,589
11-01-14 조회 1,054
11-01-14 조회 926
11-01-14 조회 866
11-01-14 조회 928
11-01-14 조회 1,612
11-01-14 조회 1,651
11-01-13 조회 1,285
11-01-13 조회 1,683
11-01-13 조회 1,031
11-01-13 조회 2,994
11-01-13 조회 3,063
11-01-13 조회 1,655
11-01-13 조회 1,328