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

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

팁앤테크

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

페이지 정보

본문

첨부된 이미지를 한눈에 볼수 있습니다.
 
기능...
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 825건 28 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 추천 날짜
150 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12535 0 09-30
149 메빅맨쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 15252 0 09-19
148 메빅맨쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 13187 0 09-19
147 메빅맨쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 14284 0 09-19
146 메빅맨쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18751 0 09-19
145 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13317 0 09-04
144 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14387 0 08-31
143 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 20724 0 08-07
142 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12754 0 07-29
141 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 22228 0 07-23
140 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 11321 0 07-17
139 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13494 0 07-16
138 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13714 0 07-16
137 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12687 0 07-08
136 월드컵쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15562 0 07-06
135 월드컵쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 15206 0 07-06
열람중 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14947 0 07-04
133 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13632 0 07-01
132 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12272 0 06-30
131 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12801 0 06-29
130 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14821 0 06-24
129 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14607 0 06-20
128 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 14226 0 06-19
127 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 12536 0 06-16
126 제로쪽지보내기 메일보내기 홈페이지 자기소개 아이디로 검색 전체게시물 13629 0 06-04

검색

회원로그인

회원가입

사이트 정보

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

접속자집계

오늘
3,360
어제
5,081
최대
7,259
전체
1,282,525
Copyright (c) 株式会社YHPLUS. All rights reserved.