게시판에 이미지 등록할때 오류가 발생합니다. 정보
그누보드 게시판에 이미지 등록할때 오류가 발생합니다.- Visual_Sun 홈페이지 자기소개 아이디로 검색 회원게시물 (211.♡.♡.108)
- 402
관련링크
첨부파일
본문
게시판에 이미지를 등록할 때, 오류가 발생합니다.
이미지를 파일로 업로드 시키면 아무 문제가 없는데, HTML 에 체크를 하고, <img> 태그를 이용하여 올리면 위의 그림과 같은 오류가 발생합니다.
오류가 발생하는 곳의 주소입니다.
http://www.ohman.or.kr/gnu3/?doc=bbs/gnuboard.php&bo_table=faq&page=1&wr_id=4
이 게시판 뿐만이 아니라 다른게시판에서도 마찬가지 현상이 일어납니다.
대략 내용을 찾아보았는데, 이미지를 파일로 업로드 할때, 테이블보다 큰 이미지 사이즈를 자동으로 조정해 주는 부분이더군요.
아래는 위의 오류가 나는 게시판의 gbview.skin.php 입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// HTML 이면
if ($write[wr_html])
$content = preg_replace("/(\<img)([^\>]*)(\>)/i", "\\1 name=target_resize_image[] onclick=image_window2(this) style='cursor:hand;' tmp_width=0 tmp_height=0 \\2 \\3", $content);
?>
<script language="JavaScript">
<!--
function image_window2(src)
{
var img = src.src;
var tmp_w = w = src.tmp_width;
var tmp_h = h = src.tmp_height;
winl = (screen.width-w)/2;
wint = (screen.height-h)/3;
if (w >= screen.width) {
winl = 0;
w = screen.width - 10;
h = (parseInt)(w * (h / w));
}
if (h >= screen.height) {
wint = 0;
h = screen.height - 80;
w = (parseInt)(h * (w / h));
}
var settings ='width='+w+',';
settings +='height='+h+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=no,';
settings +='resizable=no,';
settings +='status=no';
win=window.open("","newWindow",settings);
win.document.open();
win.document.write ("<html><head><meta http-equiv='content-type' content='text/html; charset=euc-kr'>");
win.document.write ("<title>이미지 보기</title></head>");
win.document.write ("<body leftmargin=0 topmargin=0>");
win.document.write ("<img src='"+img+"' width='"+w+"' height='"+h+"'border=0 onclick='window.close();' style='cursor:hand'>");
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
//-->
</script>
<!-- 2003.11.26 작성 -->
<!-- 원글 내용 -->
<style>
.tt {font-size:9pt; COLOR: #575757;}
</style>
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr height=30 bgcolor=#F5F3EE>
<td> <span class=tt><b><? if ($is_category) echo "[$category_name] "; ?><?=$subject?></b></span></td>
<td align=right><span class=tt><?=$datetime?></span> </td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color="cf4900">이름</font> : <?=$name?> (<?=$ip?>) <font color="cf4900">조회</font> : <?=$hit?> <? if ($is_good) echo "<font color='#cf4900'>추천</font> : " . $good; ?> <? if ($is_nogood) echo "<font color='#cf4900'>비추천</font> : " . $nogood; ?></td></tr>
<tr><td colspan=2 height=1 bgcolor=#D4CFC3></td></tr>
<tr>
<td colspan=2>
<table width=100% cellpadding=5>
<tr>
<td style='word-break:break-all;' class='lh' height=100>
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
<!-- 내용 출력 -->
<span class=content><?=$content?></span>
<!-- 테러 태그 방지용 -->
</xml></xmp><a href=""></a><a href=''></a>
</td>
</tr>
<?
// 링크 설정한 값만큼 출력
for ($i=1; $i<=$cfg[link_count]; $i++) {
if ($link[$i][link]) { echo "<tr><td class=tt> <img src='$board_skin/icon_link.gif' align='absmiddle'> <a href='{$link[$i][href]}' target='$default[de_link_target]'><span class=tt>{$link[$i][link]}</span></a>, Hit:{$link[$i][hit]}</td></tr>"; }
}
?>
<?
// 파일 업로드 설정한 값만큼 출력
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][source]) { echo "<tr><td class=tt> <img src='$board_skin/icon_download.gif' align='absmiddle'> <a href='{$file[$i][href]}'><span class=tt>{$file[$i][source]} ({$file[$i][size]})</span></a>, Down:{$file[$i][download]}</td></tr>"; }
}
?>
<? if ($is_signature) { echo "<tr><td>$signature</td></tr>"; } // 서명 출력 ?>
</table>
</td>
</tr>
</table><br>
<? if ($is_comment) { ?>
<!-- 코멘트 내용 -->
<? for ($i=0; $i<count($list); $i++) { ?>
<a name='c<?=$list[$i][wr_id]?>'></a>
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=25 bgcolor=#F1F1F1> <?=$list[$i][name]?></td>
<td align=right bgcolor=#F1F1F1><font color="cf4900"><?=$list[$i][datetime]?></font> <? if ($list[$i][is_del]) { echo "{$list[$i][del_href]}<img src='$board_skin/com_del.gif' border=0 align=absmiddle></a> "; } ?></td>
</tr>
<tr>
<td colspan=2 valign=top>
<table width=100% cellpadding=7 cellspacing=0>
<tr>
<td style='word-break:break-all; text-align:justify;' class='lh tt'><?=$list[$i][content]?></td>
</tr>
<tr><td colspan=2 align=right> <?=$list[$i][ip]?></td></tr>
</table>
</td>
</tr>
</table>
<? } // for ?>
<? if ($is_comment_write) { ?>
<!-- 코멘트 쓰기 -->
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr><td height=1 bgcolor=#D4CFC3></td></tr>
</table><br>
<table width=<?=$width?> align=center cellpadding=0 cellspacing=0 border=0>
<form name=fgbview method=post action='./?doc=bbs/gbupdate.php'>
<input type=hidden name=w value='c'>
<input type=hidden name=bo_table value='<?=$bo_table?>'>
<input type=hidden name=sselect value='<?=$sselect?>'>
<input type=hidden name=stext value='<?=$stext?>'>
<input type=hidden name=wr_id value='<?=$wr_id?>'>
<input type=hidden name=page value='<?=$page?>'>
<input type=hidden name=section value='<?=$section?>'>
<colgroup width=170>
<colgroup width=''>
<colgroup width=50>
<tr>
<td>
<table width=100%>
<tr>
<td width=70><img src='<?=$board_skin?>/img_name.gif'></td>
<td width=100><?=$c_name?></td>
</tr>
<? if ($is_guest) { ?>
<tr>
<td><img src='<?=$board_skin?>/img_pw.gif'></td>
<td><input type=password name=wr_passwd size=10 class=input required itemname='비밀번호'></td>
</tr>
<? } ?>
</table>
</td>
<td> <textarea name=wr_content rows=5 style='width:98%; line-height:150%;' required itemname='내용' class=textarea></textarea></td>
<td>
<table width=100%>
<tr><td><input type=image src='<?="$board_skin/btncomment.gif"?>' border=0 align=absmiddle></td></tr>
<tr><td><a href='javascript:textarea_size(document.fgbview.wr_content, 5)'><img src='<?=$board_skin?>/icon_down.gif' border=0></a> <a href='javascript:textarea_size(document.fgbview.wr_content, -5)'><img src='<?=$board_skin?>/icon_up.gif' border=0></a></td></tr>
</table>
</td>
</tr>
</form>
</table><br>
<? } // if ?>
<? } // if ?>
<!-- 링크 -->
<table width=<?=$width?> align=center border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2 height=1 bgcolor=#D4CFC3></td></tr>
<tr>
<td width=70% height=35>
<? if ($search_href) { echo "<a href=\"$search_href\"><img src='$board_skin/searchlist.gif' border=0 alt='검색목록' align=absmiddle></a>"; } ?>
<? echo "<a href=\"$list_href\"><img src='$board_skin/list.gif' border=0 alt='목록' align=absmiddle></a>"; ?>
<? if ($write_href) { echo "<a href=\"$write_href\"><img src='$board_skin/write.gif' border=0 alt='글쓰기' align=absmiddle></a>"; } ?>
<? if ($reply_href) { echo "<a href=\"$reply_href\"><img src='$board_skin/reply.gif' border=0 alt='답변' align=absmiddle></a>"; } ?>
<? if ($update_href) { echo "<a href=\"$update_href\"><img src='$board_skin/edit.gif' border=0 alt='수정' align=absmiddle></a>"; } ?>
<? if ($delete_href) { echo "<a href=\"$delete_href\"><img src='$board_skin/delete.gif' border=0 alt='삭제' align=absmiddle></a>"; } ?>
<? if ($good_href) { echo "<a href=\"$good_href\"><img src='$board_skin/good.gif' border=0 alt='추천' align=absmiddle></a>"; } ?>
<? if ($nogood_href) { echo "<a href=\"$nogood_href\"><img src='$board_skin/nogood.gif' border=0 alt='비추천' align=absmiddle></a>"; } ?>
<? if ($copy_href) { echo "<a href=\"$copy_href\"><img src='$board_skin/copy.gif' border=0 alt='복사' align=absmiddle></a>"; } ?>
<? if ($move_href) { echo "<a href=\"$move_href\"><img src='$board_skin/move.gif' border=0 alt='이동' align=absmiddle></a>"; } ?>
</td>
<td width=30% align=right>
<? if ($prev_href) { echo "<a href=\"$prev_href\" title=\"$prev_wr_subject\"><img src='$board_skin/prev.gif' border=0 alt='이전글' align=absmiddle></a>"; } ?>
<? if ($next_href) { echo "<a href=\"$next_href\" title=\"$next_wr_subject\"><img src='$board_skin/next.gif' border=0 alt='다음글' align=absmiddle></a>"; } ?>
</td>
</tr>
</table>
<script language="JavaScript">
<!--
// HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다.
// 제로보드 참고
function resize_image()
{
var target = document.getElementsByName('target_resize_image[]');
for(i=0; i<target.length; i++) {
// 원래 사이즈를 저장해 놓는다
target[i].tmp_width = target[i].width;
target[i].tmp_height = target[i].height;
// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
if(target[i].width > document.main_table.width)
target[i].width = document.main_table.width;
}
}
window.onload = resize_image;
//-->
</script>
이미지를 파일로 업로드 시키면 아무 문제가 없는데, HTML 에 체크를 하고, <img> 태그를 이용하여 올리면 위의 그림과 같은 오류가 발생합니다.
오류가 발생하는 곳의 주소입니다.
http://www.ohman.or.kr/gnu3/?doc=bbs/gnuboard.php&bo_table=faq&page=1&wr_id=4
이 게시판 뿐만이 아니라 다른게시판에서도 마찬가지 현상이 일어납니다.
대략 내용을 찾아보았는데, 이미지를 파일로 업로드 할때, 테이블보다 큰 이미지 사이즈를 자동으로 조정해 주는 부분이더군요.
아래는 위의 오류가 나는 게시판의 gbview.skin.php 입니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// HTML 이면
if ($write[wr_html])
$content = preg_replace("/(\<img)([^\>]*)(\>)/i", "\\1 name=target_resize_image[] onclick=image_window2(this) style='cursor:hand;' tmp_width=0 tmp_height=0 \\2 \\3", $content);
?>
<script language="JavaScript">
<!--
function image_window2(src)
{
var img = src.src;
var tmp_w = w = src.tmp_width;
var tmp_h = h = src.tmp_height;
winl = (screen.width-w)/2;
wint = (screen.height-h)/3;
if (w >= screen.width) {
winl = 0;
w = screen.width - 10;
h = (parseInt)(w * (h / w));
}
if (h >= screen.height) {
wint = 0;
h = screen.height - 80;
w = (parseInt)(h * (w / h));
}
var settings ='width='+w+',';
settings +='height='+h+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=no,';
settings +='resizable=no,';
settings +='status=no';
win=window.open("","newWindow",settings);
win.document.open();
win.document.write ("<html><head><meta http-equiv='content-type' content='text/html; charset=euc-kr'>");
win.document.write ("<title>이미지 보기</title></head>");
win.document.write ("<body leftmargin=0 topmargin=0>");
win.document.write ("<img src='"+img+"' width='"+w+"' height='"+h+"'border=0 onclick='window.close();' style='cursor:hand'>");
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
//-->
</script>
<!-- 2003.11.26 작성 -->
<!-- 원글 내용 -->
<style>
.tt {font-size:9pt; COLOR: #575757;}
</style>
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr height=30 bgcolor=#F5F3EE>
<td> <span class=tt><b><? if ($is_category) echo "[$category_name] "; ?><?=$subject?></b></span></td>
<td align=right><span class=tt><?=$datetime?></span> </td>
</tr>
<tr><td colspan=2 height=1 bgcolor=#C3BEB2></td></tr>
<tr><td colspan=2 height=25> <font color="cf4900">이름</font> : <?=$name?> (<?=$ip?>) <font color="cf4900">조회</font> : <?=$hit?> <? if ($is_good) echo "<font color='#cf4900'>추천</font> : " . $good; ?> <? if ($is_nogood) echo "<font color='#cf4900'>비추천</font> : " . $nogood; ?></td></tr>
<tr><td colspan=2 height=1 bgcolor=#D4CFC3></td></tr>
<tr>
<td colspan=2>
<table width=100% cellpadding=5>
<tr>
<td style='word-break:break-all;' class='lh' height=100>
<?
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][view]) { echo $file[$i][view]; }
}
?>
<!-- 내용 출력 -->
<span class=content><?=$content?></span>
<!-- 테러 태그 방지용 -->
</xml></xmp><a href=""></a><a href=''></a>
</td>
</tr>
<?
// 링크 설정한 값만큼 출력
for ($i=1; $i<=$cfg[link_count]; $i++) {
if ($link[$i][link]) { echo "<tr><td class=tt> <img src='$board_skin/icon_link.gif' align='absmiddle'> <a href='{$link[$i][href]}' target='$default[de_link_target]'><span class=tt>{$link[$i][link]}</span></a>, Hit:{$link[$i][hit]}</td></tr>"; }
}
?>
<?
// 파일 업로드 설정한 값만큼 출력
for ($i=1; $i<=$cfg[file_count]; $i++) {
if ($file[$i][source]) { echo "<tr><td class=tt> <img src='$board_skin/icon_download.gif' align='absmiddle'> <a href='{$file[$i][href]}'><span class=tt>{$file[$i][source]} ({$file[$i][size]})</span></a>, Down:{$file[$i][download]}</td></tr>"; }
}
?>
<? if ($is_signature) { echo "<tr><td>$signature</td></tr>"; } // 서명 출력 ?>
</table>
</td>
</tr>
</table><br>
<? if ($is_comment) { ?>
<!-- 코멘트 내용 -->
<? for ($i=0; $i<count($list); $i++) { ?>
<a name='c<?=$list[$i][wr_id]?>'></a>
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td height=25 bgcolor=#F1F1F1> <?=$list[$i][name]?></td>
<td align=right bgcolor=#F1F1F1><font color="cf4900"><?=$list[$i][datetime]?></font> <? if ($list[$i][is_del]) { echo "{$list[$i][del_href]}<img src='$board_skin/com_del.gif' border=0 align=absmiddle></a> "; } ?></td>
</tr>
<tr>
<td colspan=2 valign=top>
<table width=100% cellpadding=7 cellspacing=0>
<tr>
<td style='word-break:break-all; text-align:justify;' class='lh tt'><?=$list[$i][content]?></td>
</tr>
<tr><td colspan=2 align=right> <?=$list[$i][ip]?></td></tr>
</table>
</td>
</tr>
</table>
<? } // for ?>
<? if ($is_comment_write) { ?>
<!-- 코멘트 쓰기 -->
<table width=<?=$width?> border=0 align=center cellpadding=0 cellspacing=0>
<tr><td height=1 bgcolor=#D4CFC3></td></tr>
</table><br>
<table width=<?=$width?> align=center cellpadding=0 cellspacing=0 border=0>
<form name=fgbview method=post action='./?doc=bbs/gbupdate.php'>
<input type=hidden name=w value='c'>
<input type=hidden name=bo_table value='<?=$bo_table?>'>
<input type=hidden name=sselect value='<?=$sselect?>'>
<input type=hidden name=stext value='<?=$stext?>'>
<input type=hidden name=wr_id value='<?=$wr_id?>'>
<input type=hidden name=page value='<?=$page?>'>
<input type=hidden name=section value='<?=$section?>'>
<colgroup width=170>
<colgroup width=''>
<colgroup width=50>
<tr>
<td>
<table width=100%>
<tr>
<td width=70><img src='<?=$board_skin?>/img_name.gif'></td>
<td width=100><?=$c_name?></td>
</tr>
<? if ($is_guest) { ?>
<tr>
<td><img src='<?=$board_skin?>/img_pw.gif'></td>
<td><input type=password name=wr_passwd size=10 class=input required itemname='비밀번호'></td>
</tr>
<? } ?>
</table>
</td>
<td> <textarea name=wr_content rows=5 style='width:98%; line-height:150%;' required itemname='내용' class=textarea></textarea></td>
<td>
<table width=100%>
<tr><td><input type=image src='<?="$board_skin/btncomment.gif"?>' border=0 align=absmiddle></td></tr>
<tr><td><a href='javascript:textarea_size(document.fgbview.wr_content, 5)'><img src='<?=$board_skin?>/icon_down.gif' border=0></a> <a href='javascript:textarea_size(document.fgbview.wr_content, -5)'><img src='<?=$board_skin?>/icon_up.gif' border=0></a></td></tr>
</table>
</td>
</tr>
</form>
</table><br>
<? } // if ?>
<? } // if ?>
<!-- 링크 -->
<table width=<?=$width?> align=center border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2 height=1 bgcolor=#D4CFC3></td></tr>
<tr>
<td width=70% height=35>
<? if ($search_href) { echo "<a href=\"$search_href\"><img src='$board_skin/searchlist.gif' border=0 alt='검색목록' align=absmiddle></a>"; } ?>
<? echo "<a href=\"$list_href\"><img src='$board_skin/list.gif' border=0 alt='목록' align=absmiddle></a>"; ?>
<? if ($write_href) { echo "<a href=\"$write_href\"><img src='$board_skin/write.gif' border=0 alt='글쓰기' align=absmiddle></a>"; } ?>
<? if ($reply_href) { echo "<a href=\"$reply_href\"><img src='$board_skin/reply.gif' border=0 alt='답변' align=absmiddle></a>"; } ?>
<? if ($update_href) { echo "<a href=\"$update_href\"><img src='$board_skin/edit.gif' border=0 alt='수정' align=absmiddle></a>"; } ?>
<? if ($delete_href) { echo "<a href=\"$delete_href\"><img src='$board_skin/delete.gif' border=0 alt='삭제' align=absmiddle></a>"; } ?>
<? if ($good_href) { echo "<a href=\"$good_href\"><img src='$board_skin/good.gif' border=0 alt='추천' align=absmiddle></a>"; } ?>
<? if ($nogood_href) { echo "<a href=\"$nogood_href\"><img src='$board_skin/nogood.gif' border=0 alt='비추천' align=absmiddle></a>"; } ?>
<? if ($copy_href) { echo "<a href=\"$copy_href\"><img src='$board_skin/copy.gif' border=0 alt='복사' align=absmiddle></a>"; } ?>
<? if ($move_href) { echo "<a href=\"$move_href\"><img src='$board_skin/move.gif' border=0 alt='이동' align=absmiddle></a>"; } ?>
</td>
<td width=30% align=right>
<? if ($prev_href) { echo "<a href=\"$prev_href\" title=\"$prev_wr_subject\"><img src='$board_skin/prev.gif' border=0 alt='이전글' align=absmiddle></a>"; } ?>
<? if ($next_href) { echo "<a href=\"$next_href\" title=\"$next_wr_subject\"><img src='$board_skin/next.gif' border=0 alt='다음글' align=absmiddle></a>"; } ?>
</td>
</tr>
</table>
<script language="JavaScript">
<!--
// HTML 로 넘어온 <img ... > 태그의 폭이 테이블폭보다 크다면 테이블폭을 적용한다.
// 제로보드 참고
function resize_image()
{
var target = document.getElementsByName('target_resize_image[]');
for(i=0; i<target.length; i++) {
// 원래 사이즈를 저장해 놓는다
target[i].tmp_width = target[i].width;
target[i].tmp_height = target[i].height;
// 이미지 폭이 테이블 폭보다 크다면 테이블폭에 맞춘다
if(target[i].width > document.main_table.width)
target[i].width = document.main_table.width;
}
}
window.onload = resize_image;
//-->
</script>
댓글 전체
아 게시판 리스트 펼침을 말씀하시는 거였군요.
그 게시판이 펼침을 쓰고 있긴 합니다.
그런데, 그 게시판 뿐만이 아니라, 다른게시판에서도, 위의 오류는 동일하게 출력이 됩니다.
아래 주소는 다른게시판에 <img>태그를 이용하여 올린것입니다.
http://www.ohman.or.kr/gnu3/?doc=bbs/gnuboard.php&bo_table=notice&wr_id=13
그 게시판이 펼침을 쓰고 있긴 합니다.
그런데, 그 게시판 뿐만이 아니라, 다른게시판에서도, 위의 오류는 동일하게 출력이 됩니다.
아래 주소는 다른게시판에 <img>태그를 이용하여 올린것입니다.
http://www.ohman.or.kr/gnu3/?doc=bbs/gnuboard.php&bo_table=notice&wr_id=13
리스트에서 펼침을 쓰고 계시지요.
펼침형식이라면 좌측의 메뉴부분을 말씀하시는 건가요?
제 생각에는 펼침형식(?) 때문이 아닌가 합니다.
펼침을 제거후, 해 보세요.
펼침을 제거후, 해 보세요.