[최근갤러리] 플래시 및 한글 파일명 첨부할때 엑박 해결 > 그누4 스킨

그누4 스킨

스킨의 저작권은 해당 스킨 제작자님께 있으며, 그누보드의 저작권과 다를 수 있습니다.
스킨 다운로드시 좋아요와 감사의 코멘트를 남기시면 제작자에게 큰 힘이됩니다. ^^y
그누보드와 관련이 있지만 스킨과 빌더가 아니면 플러그인 게시판에 올려주세요.

[최근갤러리] 플래시 및 한글 파일명 첨부할때 엑박 해결 정보

최근게시물 [최근갤러리] 플래시 및 한글 파일명 첨부할때 엑박 해결

첨부파일

hp_utf8_gallery4.zip (6.9K) 16회 다운로드 2008-05-08 21:58:42
hp_kr_gallery4.zip (6.8K) 29회 다운로드 2008-05-08 21:58:42
happyjung.euckr.php (1,021byte) 8회 다운로드 2008-05-08 21:58:42

본문

하나로 여러가지 최근겔러리를 관리하기위해 제작하였습니다.
다양한 옵션으로 응용이 가능한 최근겔러리 입니다.

hp_utf8_gallery4 ::: UTF-8 버전
hp_kr_gallery4    ::: EUC-KR 버전

사용방법 :: 아래를 복사하여 최신갤러리 삽입위치에 추가한후 옵션 변경

<?=latest("hp_utf8_gallery4",  "test",  6,  100, "80, 2, 200, 10, #ffff, 1" );
// option("hp_utf8_gallery4",  "테이블명",  전체갯수,  가로폭, "세로폭, row, 테이블폭, 빈TR높이, 제목글자색, 제목노출여부");
// 제목안보일때 = 0 , 제목보일때 = 1 ?>

row를 2로 설정할 경우 6개를 2줄로 나눠서 한줄에 3개씩 보이게 됩니다.


도움받은곳
izen 님  http://www.sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=13224 
까만도둑 님  http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=2532


그누보드 / extend / happyjung.lib.php 파일을 하나 만들어서 아래 내용을 삽입

<?

# 최신글 추출에서 갤러리 GD로 불러오기 ( 첨부파일 한글인 경우도 정상작동 )
# 도움주신분 : 까만도둑 http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=2532
function gga_image_size($x, $y, $thumbx, $thumby) {
  if($x > $thumbx) {
      $overx = ($x - $thumbx) / $x;
      $x = $thumbx;
      $y = intval($y - ($y * $overx));
  }
  if($y > $thumby) {
      $overy = ($y - $thumby) / $y;
      $y = $thumby;
      $x = intval($x - ($x * $overy));
  }
  return array('x'=>$x, 'y'=>$y);
}

function gga_thumb_filename2($num, $seq) {
  return sprintf("%05d", $num) . "_" . sprintf("%03d", $seq);
}
?>



그누보드 / skin / latest / hp_gallery4 / latest.skin.php 파일 생성후 아래 내용 삽입

<?
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

/*
사용방법 :: 아래를 복사하여 최신갤러리 삽입위치에 추가한후 옵션 변경

<?=latest("hp_utf8_gallery4",  "test",  6,  100, "80, 2, 200, 10, #ffff, 1" );
// option("hp_utf8_gallery4",  "테이블명",  전체갯수,  가로폭, "세로폭, row, 테이블폭, 빈TR높이, 제목글자색, 제목노출여부");
// 제목안보일때 = 0 , 제목보일때 = 1 ?>

row를 2로 설정할 경우 6개를 2줄로 나눠서 한줄에 3개씩 보이게 됩니다.
*/

list($height, $row_cnt, $table_width, $td_height, $link_color, $title_view) = explode(",", $options);
//list($height, $row_cnt, $cut_len, $link_color) = explode(",", $options);
$all_cnt = 0;

$happyjung_latest_height = "20"; // 글 제목 높이값

$thumbx = 120;
$thumby = 120;
?>
<!-- <?=$board[bo_subject]?> (<?=$board[bo_table]?>) 최신글 -->
<table width='<?=$table_width?>' cellpadding='0' cellspacing='0' border='0' align='left'>
<? /* ?>
  <tr>
    <td><table width='100%' border='0' cellspacing='0' cellpadding='0'>
      <tr>
        <td style="padding:3 0 3 3;"><strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><?=$board[bo_subject]?></a></strong></td>
        <td align="right" style="padding:0 3 0 0;"><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a></td>
      </tr>
      <tr>
        <td colspan=2 height=2 bgcolor='#cccccc'></td>
      </tr>
    </table></td>
  </tr>
<? */ ?>
  <tr>
    <td align='center'><table width='100%'>
<?
for ($k=0; $k<$row_cnt; $k++ ) {
?>
      <tr>
<?
  for ($i=0; $i<count($list)/$row_cnt; $i++) {
    if ($i > 0)
      echo '<td width=20>&nbsp;</td>';
    $title = get_text($list[$all_cnt][wr_subject]);
    $content = cut_str(get_text($list[$all_cnt][wr_content]), 80);
    $img = "$g4[path]/data/file/$bo_table/".urlencode($list[$all_cnt][file][0][file]);

    $file_name = get_thumb_filename2($list[$i][wr_id], 0);
# utf-8 에서 한글 공백 있는 글자 정상작동 확인
    $file = "$g4[path]/data/file/$bo_table/".$list[$all_cnt][file][0][file];
//  $file = "$g4[path]/data/file/$bo_table/".urlencode($list[$all_cnt][file][0][file]);

    $destfile = $file.'_gga_gd_latest_Thumb';
    $size = @getimagesize($file);
    if(is_array($size) && !is_file($destfile)) {
      switch($size[2]) {
        case(1) :
          if(function_exists('ImageCreateFromGif')) $im = ImageCreateFromGif($file);
          break;
        case(2) :
          if(function_exists('ImageCreateFromJpeg')) $im = ImageCreateFromJpeg($file);
          break;
        case(3) :
          if(function_exists('ImageCreateFromPng')) $im = ImageCreateFromPng($file);
          break;
      }
      $fixsize = gga_image_size($size[0], $size[1], $thumbx, $thumby);
      if($im) {
        if($i==0) @exec("rm ".dirname($_SERVER[SCRIPT_FILENAME])."$g4[path]/data/file/$bo_table/*reportThumb -rf");
     
        if(function_exists('ImageCreateTrueColor')) $newim = ImageCreateTrueColor($fixsize[x],$fixsize[y]);
        else $newim = ImageCreate($fixsize[x],$fixsize[y]);
     
        if(function_exists('ImageCopyResampled')) ImageCopyResampled($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
        else ImageCopyResized($newim,$im,0,0,0,0,$fixsize[x],$fixsize[y],$size[0],$size[1]);
     
        ImageDestroy($im);
        ImageJpeg($newim, $destfile, 100);
        ImageDestroy($newim);
        unset($im, $newim);
      }
      $list[$i][img][x] = $fixsize[x];
      $list[$i][img][y] = $fixsize[y];
    } else {
      if(is_file($destfile)) {
        $size = @getimagesize($destfile);
        $list[$i][img][x] = $size[0];
        $list[$i][img][y] = $size[1];
      } else {
        $file = "$latest_skin_path/img/no_image.gif";
        $size = @getimagesize($file);
        $list[$i][img][x] = $size[0];
        $list[$i][img][y] = $size[1];
      }
    }
    if(is_file($destfile)) $file = $destfile;
    if(time()-(60*60*24) <= strtotime($list[$i][wr_datetime])) $list[$i][date] = date('H:i',strtotime($list[$i][wr_datetime]));
    else $list[$i][date] = date('Y.m.d',strtotime($list[$i][wr_datetime]));

    $file = str_replace('%', '%25', $file);

    $href = "$g4[bbs_path]/board.php?bo_table=$bo_table";
    $stitle = $list[$all_cnt][subject];
//    $stitle = cut_str($list[$all_cnt][subject],$cut_len,"...");
?>
        <td width='<?=$subject_len?>' valign='top' align='center'><table width='<?=$subject_len?>' border='0' cellpadding='0' cellspacing='0' align='center' style='table-layout:fixed'>
          <tr>
            <td width='<?=$subject_len?>' height='<?=$td_height?>'></td>
          </tr>
          <tr>
            <td width='<?=$subject_len?>' height='<?=$height?>' style='width:<?=$subject_len?>px;height:<?=$height?>px;' align='center'><?
            if (preg_match("/\.(gif|jpg|png)$/i", $img)) { // 첫 파일이 이미지인지 검사
              echo "<a href='{$g4[bbs_path]}/board.php?bo_table={$bo_table}&wr_id={$list[$all_cnt][wr_id]}' class='happyjung_latest_link'><img src='$file' width='$subject_len' height='$height' border='0' align='absmiddle' title='{$title}'></a>";
            } else if (preg_match("/\.(swf|wmv|asf)$/i", $img)) { // 플래시일때
              echo"<script>doc_write(flash_movie('$file', 'flash$i',  width='$subject_len', height='$height', 'transparent'));</script>";
            }
            ?></td>
          </tr>
          <? if ($title_view == 1) { ?>
          <tr>
            <td height='5' align='center'></td>
          </tr>
          <tr>
            <td align='center' style='text-overflow: ellipsis; overflow: hidden; color:<?=$link_color?>' nowrap><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&wr_id=<?=$list[$all_cnt][wr_id]?>'><font color=<?=$link_color?>><?=$stitle?></font></a></td>
          </tr>
          <? } ?>
        </table></td>
<?
    $all_cnt++;
  }
?>
      </tr>
<?
}
 
if (count($list) == 0) {
?>
      <tr>
        <td colspan=2 align='center' height=25>게시물이 없습니다.</td>
      </tr>
<?
}
?>
    </table></td>
  </tr>
</table>



2008-05-08 수정 :: function 호출로 인하여 2개이상 최근겔러리 사용시 문제 해결
추천
2

댓글 전체

전체 5,850 |RSS
그누4 스킨 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT