채팅방에 이모티콘 달기

- 11-04
- 7,255 회
- 8 건
길호님께서 올린것과는 다른 방식입니다..^^
현제 그누보드용 채팅에 적용한 상태라 그누보드 위주로 설명합니다.
다른 보드 채팅은 경로만 약간 수정하면 되리라 봅니다.
먼저 chat09_emoticon.zip
파일을 압축을 풀어서 emo.php
파일과 emoticon
폴더를
gnu/gnu_chat
폴더에 올립니다.
gnu_chat/skin/각스킨폴더/room.php
파일을 열어서 아래와 같이 수정..
입력창 : <input type=text name=test autocomplete=off>
</form>
← 이부분 아래에
<table>
<tr>
<td>
<div align=right>
<input onclick='showEmoticon()' type=checkbox name=Emoticons value='yes'>
<img src=./emoticon/i_emoticons.gif align=absmiddle border=0>이모티콘
</div>
</td>
</tr>
<tr>
<td><? include "../gnu_chat/emo.php"; ?></td>
</tr>
<table>
<SCRIPT>
// 자동링크 기능....
.....................................................................
.....................................................................
return str.replace(/___---#Done#Src#---___/g, "");
이 줄 다음에
function emoticon_html(str)
{
str=str.replace("emtc_001","<img src=http://URL/gnu/gnu_chat/emoticon/1.gif width=18 height=18 border=0>",str);
str=str.replace("emtc_002","<img src=http://URL/gnu/gnu_chat/emoticon/2.gif width=18 height=18 border=0>",str);
...
str=str.replace("emtc_105","<img src=http://URL/gnu/gnu_chat/emoticon/105.gif width=18 height=18 border=0>",str);
return str;
}
아래 채팅 출력 부분 원본
// 채팅 출력부분
function chattext(str,col)
{
<?
if(file_exists('skin/'.$skinname.'/imoticon'))
{
$handle=@opendir('skin/'.$skinname.'/imoticon/.');
while (($file = @readdir($handle))!==false)
{ $imoticon=str_replace('.gif','',$file);
if(strpos($file,'.gif')>1)
{?>
str=str.replace("<?=$imoticon?>","<img src='imoticon/<?=$file?>'>");
<?}
}
@closedir($handle);
}
?>
str=sw_autolink(str);
chatview.document.body.insertAdjacentHTML('beforeEnd', '<font color='+col+'>'+str+'</font><br>');
chatview.document.body.scrollTop=99999999;
}
원본 끝
수정
// 채팅 출력부분
function chattext(str,col)
{
str=emoticon_html(str);
str=sw_autolink(str);
chatview.document.body.insertAdjacentHTML('beforeEnd', '<font color='+col+'>'+str+'</font><br>');
chatview.document.body.scrollTop=99999999;
}
수정 끝
이모티콘이 많으면 불러오는데 시간이 약간 걸리뿐만 아니라
이모티콘 약간 깨집니다.. 적절한 개수로 짤라서 사용하세요..^^
-
-
저도 제로보드에 적용을 해봤는데 방만들기를 하면 계속해서 깨진방이라고 나옵니다.
수정은 맞게한것 같은데 뭔가 소스수정이 잘못 되었나 봅니다.
한번 봐주시겠어요?
제로보드를 사용하고 있고 주소는 <a href=http://miso.najoy.net target=_blank>http://miso.najoy.net</a> 입니다.
테스트 아이디 ; test 비밀번호 ; test
부탁좀 드릴께요.- 03-11-11
-
-
이모티콘이 깨지는 것은 그진 이모티콘 이미지 경로 문제입니다.
만약 제로보드라면 아래와 같이 URL경로를 적어주면 해결됩니다..^^
<img src=http://URL/제로보드 폴더명/길호챗 폴더명/emoticon/104.gif width=18 height=18 border=0>",str)- 03-11-11
-
-
-
-
-
-
제로보드에서의 사용법은 비슷합니다.
emo.php파일과 emoticon폴더를 채트 폴더안에 업로드 하시고
include "../gnu_chat/emo.php"; 되는 이경로를
include "../챗트폴더이름/emo.php"; 이렇게 하구요.
이미지경로는
str=str.replace("emtc_097","<img src=http://URL/gnu/gnu_chat/emoticon/97.gif
이걸전부
str=str.replace("emtc_022","<img src=/챗트폴더이름/emoticon/22.gif width=18 height=18 border=0>",str);
이렇게 수정하세요.^^엄청 노가입니다.
그다음 </form> <- 이부분 아래에
홈박스님 스킨중 00 기준
여기에 테이블블이 시작되면 이상하게 되버리더군요.^^
전아래처럼하니까 잘되네요^^
</form>
<TR>
<TD width=12><IMG SRC="skin/homebox00/images/homebox_chat_32.gif" HEIGHT=6></TD>
<TD width=54><IMG SRC="skin/homebox00/images/homebox_chat_33.gif" HEIGHT=6></TD>
<TD width=68 COLSPAN=2><IMG SRC="skin/homebox00/images/homebox_chat_34.gif" HEIGHT=6></TD>
<TD width=100% background="skin/homebox00/images/homebox_chat_35.gif"><IMG SRC="" HEIGHT=6></TD>
<TD width=53><IMG SRC="skin/homebox00/images/homebox_chat_36.gif" HEIGHT=6></TD>
<TD width=16><IMG SRC="skin/homebox00/images/homebox_chat_37.gif" HEIGHT=6></TD>
<TD width=16><IMG SRC="skin/homebox00/images/homebox_chat_38.gif" HEIGHT=6></TD>
<TD width=136><IMG SRC="skin/homebox00/images/homebox_chat_39.gif" HEIGHT=6></TD>
<TD width=13><IMG SRC="skin/homebox00/images/homebox_chat_40.gif" HEIGHT=6></TD>
</TR>
<TABLE width="600" BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center"><!--이모티콘출력시작-->
<TR>
<TD align=center><div align=right>
<input onclick='showEmoticon()' type=checkbox name=Emoticons value='yes'><img src=./emoticon/i_emoticons.gif align=absmiddle border=0>이모티콘
</div>
</TD>
</TR>
<TR>
<TD align=center><? include "../kchat3/emo.php"; ?>
</TD>
</TR>
<table><!--이모티콘끝-->
</TABLE>
<OBJECT id="KChat" classid="clsid:86A9E0B2-B22C-4EF9-A29C-7870FAD5C072"- 03-11-04
-
로그인 후 댓글내용을 입력해주세요