[제로] 첨부파일 이미지 업로드시 미리보기 및 수정시 이미지 미리보기

페이지 정보

yadolee 루루아빠 3,422 2005.06.24 02:26:03

평점

  • 평점 : 0점 (0명 참여)

본문

1. 첨부파일 이미지 업로드시 미리보기

 적용할 게시판 스킨 폴더 write.php 파일 상단에 아래 스크립트 삽입

<script>
 function img_filetype_view()
         {
         img_views = "view_" + event.srcElement.name.split("file")[1];
        
         if(event.srcElement.value.match(/(.jpg|.jpeg|.gif|.png|.bmp|.pdf)$/))
         {
                 document.images[img_views].src = event.srcElement.value;
                 document.images[img_views].style.display = "";
         }
         else
         {
                 document.images[img_views].style.display = "none";
         }
         }
 </script>

같은 파일 주욱~ 밑으로 내려가서 아래 부분과 비슷한 부분을 찾아서
<?=$hide_pds_start?>

 <input> 이부분을 다음과 같이 수정합니다..
 <input type=file name=file1 <?=size(40)?> maxlength=255 class=input onChange="img_filetype_view()"><img src=$dir/t.gif border=0 width=0><br><img id=view_1 width='200' style="display:none;"><?=$file_name1?>

 <input type=file name=file2 <?=size(40)?> maxlength=255 class=input onChange="img_filetype_view()"><img src=$dir/t.gif border=0 width=0><br><img id=view_2 width='200' style="display:none;"><?=$file_name2?>


 2. 수정시 첨부 이미지 미리보기

bbs/write.php에서


        if($mode=="modify") {
찾아서 조금 내려오면

if($data[file_name1])$file_name1="<br><img src=$data[file_name1] width='100'> ".$data[s_file_name1]."이 등록되어 있습니다. <input type=checkbox name=del_file1 value=1> 삭제";
if($data[file_name2])$file_name2="<br><img src=$data[file_name2] width='100'>".$data[s_file_name2]."이 등록되어 있습니다. <input type=checkbox name=del_file2 value=1> 삭제";

이 부분을 아래와 같이 수정합니다.

if(eregi("\.gif|\.jpg",$data[file_name1])) $filename1 = $_zb_url.$data[file_name1];
 if(eregi("\.gif|\.jpg",$data[file_name2])) $filename2 = $_zb_url.$data[file_name2];

 if($filename1) $imgList1.="<img src='$filename1' border=0 style=border-color:black width=200 vspacing=10 hspacing=10>";
 else $imgList1.="<img src='images/no_image.gif' border=1 style=border-color:black width=200 vspacing=10 hspacing=10>";
 if($filename2) $imgList2.="<img src='$filename2' border=0 style=border-color:black width=200 vspacing=10 hspacing=10>";
 else $imgList2.="<img src='images/no_image.gif' border=1 style=border-color:black width=1 vspacing=10 hspacing=10>"; 

추천인
  • 추천해 주세요
yadolee
6
루루아빠 - 회원등급 : 최고관리자 - 포인트 : 1,332,705
레벨 100
경험치 1,488,154

Progress Bar 10.52%

- 가입일 : 2015-03-04 03:24:54
- 서명 : KNOW YOUR LIMITS BUT NEVER STOP TRYING TO EXCEED THEM !!
- 자기소개 : 루루의 자랑 루루아빠랍니다~~

댓글

첫 번째 댓글을 남겨 주세요

Total 7623739 페이지

제목 글쓴이 날짜 조회 추천
그누•영카트  그누보드(영카트) 5.5.8.2.7 shadow2fox 2023.01.27 701 0
이윰  댓글+2 PATH만 지원되는 filemtime을 curl 이용하여  URL을 지원하도록 확장하기 shadow2fox 2023.06.13 698 2
그누•영카트  댓글+1 그누보드(영카트) 5.5.8.3 shadow2fox 2023.04.20 687 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.9 shadow2fox 2023.10.19 685 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.8.2.8 shadow2fox 2023.03.24 681 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.10 shadow2fox 2023.11.10 680 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.8 shadow2fox 2022.06.14 678 2
그누•영카트  그누보드(영카트) 5.5.3.1 (아이핀 사용시 오류 수정) shadow2fox 2022.03.08 658 0
그누•영카트  댓글+3 그누보드(영카트) 5.5.14 shadow2fox 2024.04.04 651 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.12 shadow2fox 2024.01.26 630 2
그누•영카트  댓글+1 그누보드(영카트) 5.5.8.3.4 (★ 5.5.8.3.3 버전 사용자님은 필독해 주세요) shadow2fox 2023.08.20 629 1
그누•영카트  댓글+2 그누보드(영카트) 5.5.17 shadow2fox 2024.06.09 562 2
이윰  댓글+1 게시글 삭제 시 입력한 태그 삭제하기 shadow2fox 2024.05.11 529 2
그누•영카트  댓글+2📸 그누보드(영카트) 5.5.15 shadow2fox 2024.04.12 523 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.16 shadow2fox 2024.04.18 501 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.4 shadow2fox 2024.07.04 477 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.7 shadow2fox 2024.11.01 437 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.8 shadow2fox 2024.11.27 388 3
그누•영카트  댓글+1 그누보드(영카트) 5.6.5 shadow2fox 2024.09.05 346 1
그누•영카트  댓글+1 그누보드(영카트) 5.6.6 shadow2fox 2024.09.24 326 1