[제나플러스] 본문에서 여러개 첨부 이미지를 한번에 모두 보기 > 팁앤테크

본문 바로가기
사이트 내 전체검색

팁앤테크

[제나플러스] 본문에서 여러개 첨부 이미지를 한번에 모두 보기

페이지 정보

본문

첨부된 이미지를 한눈에 볼수 있습니다.
 
기능...
1. 작은이미지에 마우스를 이동하면 아래쪽에 큰 이미지가 보입니다.
2. 작은 이미지를 클릭하면 새창에서 이미지가 보입니다.
 
 
viw.skin.php 에서 아래 내용을 
        <?
        // 파일 출력
        for ($i=0; $i<=count($view[file]); $i++) {
            if ($view[file][$i][view])
                echo $view[file][$i][view] . "<p>";
        }
        ?>
 
 
다음과 같이 교체합니다.
 
 
<SCRIPT LANGUAGE='JavaScript'>
<!--
// 이미지뷰어
var win= null;
function View_Open(img, w, h) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/3;
  var settings  ='height='+h+',';
    settings +='width='+w+',';
    settings +='top='+wint+',';
    settings +='left='+winl+',';
    settings +='scrollbars=yes,';
    settings +='resizable=yes,';
    settings +='status=no';
 
  win=window.open("","newWindow",settings);
  win.document.open();
  win.document.write ("<html><head><title>원본 이미지 보기</title></head>");
  win.document.write ("<script>function init(){window.resizeBy(document.all.pop_img.width-document.body.clientWidth, document.all.pop_img.height-document.body.clientHeight+10);}</script>");
  win.document.write ("<body bgcolor=white topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 oncontextmenu='return false' ondragstart='return false' onkeydown='return false' onselectstart='return false' onload='init();'>");
  win.document.write ("<img src='"+img+"' border=0 onclick='window.close();' style='cursor:hand' title='클릭하면 닫혀요' id='pop_img'>");
  win.document.write ("</body></html>");
  win.document.close();
}
 
image_directory = "";   //배경이미지 경로
clear = new Image();  clear.src = image_directory + "./img/blank.gif";
<?
//파일 뽑기
$sql2_hp_view_img = " 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_hp_view_img = sql_query($sql2_hp_view_img);
for ($j=0; $row2_hp_view_img = sql_fetch_array($result2_hp_view_img); $j++) {
  $view_one = "{$g4['path']}/data/file/{$bo_table}/{$row2_hp_view_img['bf_file']}";
?>
  view_img<?=$j?> = new Image();
  view_img<?=$j?>.src = "<?=$g4['path']?>/data/file/<?=$bo_table?>/<?=$row2_hp_view_img['bf_file']?>";
<? } ?>
function bgChange(imgName) {
  document.all.view_img.src = eval(imgName + ".src");
}
//-->
</SCRIPT>
<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center">
  <tr>
    <td style="padding:10 0 20 0;" align="center">
<?
//파일 뽑기
$sql_hp_view_img = " 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 ";
$result_hp_view_img = sql_query($sql_hp_view_img);
for ($i=0; $row_hp_view_img = sql_fetch_array($result_hp_view_img); $i++) {
 
  //썸네일 코드 시작
  $data_path = $g4['path'] . "/data/file/{$bo_table}";//라이브러리 파일 참조
  $thumb_path = $data_path . '/thumbOpen';
 
  $view_w = 100; //썸네일 가로사이즈
  $view_h = 75; //썸네일 세로사이즈
  $sch_q = 100; //썸네일 퀼리티
 
  if (!is_dir($thumb_path)) {
    @mkdir($thumb_path, 0707);
    @chmod($thumb_path, 0707);
  }
  $filename = $row_hp_view_img[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 width="69" height="60"></a>
<?
    //onMouseOut="bgChange('clear');"
  }
}
?>
    </td>
  </tr>
  <tr>
    <td align="center" valign="top"><img src="<?=$view_one?>" name="view_img" border="0"></td>
  </tr>
</table>
추천0

댓글목록

등록된 댓글이 없습니다.

Total 770건 27 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 추천 날짜
120 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12173 0 11-18
119 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13144 1 11-14
118 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11907 0 11-13
117 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12081 0 11-07
116 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15977 0 11-05
115 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11344 0 11-03
114 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15585 0 10-29
113 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 17013 0 10-28
112 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11589 0 10-27
111 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13460 0 10-27
110 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 10682 0 10-15
109 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 20651 0 10-10
108 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15090 0 10-10
107 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 17297 0 10-08
106 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12366 0 09-30
105 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13156 0 09-04
104 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14228 0 08-31
103 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 20576 0 08-07
102 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12610 0 07-29
101 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 22102 0 07-23
100 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11228 0 07-17
99 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13391 0 07-16
98 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13582 0 07-16
97 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12574 0 07-08
열람중 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14826 0 07-04

검색

회원로그인

회원가입

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒140-0011 東京都品川区東大井2-5-9-203
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

접속자집계

오늘
6,499
어제
6,202
최대
7,259
전체
1,248,249
Copyright (c) 株式会社YHPLUS. All rights reserved.