gnu3호환 새창으로 이미지미리보기에서 다음이미지 이전이미지 보기 처리 > 그누3 팁자료실

그누3 팁자료실

gnu3호환 새창으로 이미지미리보기에서 다음이미지 이전이미지 보기 처리 정보

gnu3호환 새창으로 이미지미리보기에서 다음이미지 이전이미지 보기 처리

본문

bbs/gbnextimg.php로 저장

<?
if (!defined("_GNUBOARD_")) exit;
define("_DOCTYPE_", "STYLE");
$html_title = "이미지 보기";

//############################################################
//## 
//##  ver : 2005. 05. 14
//##  P/G : ⓒⓒⓒ
//##  msn : http://oldccc.com
//## 
//############################################################

function get_n_image($bo_table, $wr_id) {
    global $cfg;

    $write_table = "{$cfg[write_table_prefix]}{$bo_table}";
   
    $p_wr_id = sql_fetch("SELECT wr_id FROM $write_table WHERE wr_id > $wr_id and wr_file1 <> '' order by wr_id asc");
    $n_wr_id = sql_fetch("SELECT wr_id FROM $write_table WHERE wr_id < $wr_id and wr_file1 <> '' order by wr_id desc");

    $page[p_wr_id] = $p_wr_id[0];
    $page[n_wr_id] = $n_wr_id[0];

    if($page[p_wr_id]) $page[p_button] = "<a href='?doc=bbs/gbnextimg.php&bo_table=$bo_table&wr_id=$page[p_wr_id]'>◀</a>";
    if($page[n_wr_id]) $page[n_button] = "<a href='?doc=bbs/gbnextimg.php&bo_table=$bo_table&wr_id=$page[n_wr_id]'>▶</a>";

    return $page;
}


function view_img($bo_table, $wr_id)
{
  global $cfg, $pn_img;

    $data = sql_fetch("SELECT wr_file1 FROM {$cfg[write_table_prefix]}{$bo_table} WHERE wr_id ='$wr_id' ");

    $file = $data[0];   

    $dir = "./data/file/$bo_table";
    $size = @getimagesize("$dir/$file");
    $source_width  = $size[0];
    $source_height = $size[1];

    if ($board[bo_table_width] <= 100) {
        if ($size[0] > $cfg[large_image_size]) {
            $rate = $size[1] / $size[0];
            $size[0] = $cfg[large_image_size];
            $size[1] = (int)($size[0] * $rate);
        }
    } else {
        if ($size[0] > $board[bo_table_width]) {
            $rate = $size[1] / $size[0];
            $size[0] = $board[bo_table_width];
            $size[1] = (int)($size[0] * $rate);
        }
    }

    $img[width]  = $size[0];
    $img[height] = $size[1];

    if (preg_match($cfg[image_extension], $file))
    $img[a_img] = "<img src='$dir/$file' width=$img[width] height=$img[height] border=0 onclick='window.close();' style='cursor:hand'>";
    $img[a_img] .="<table cellpadding='0' cellspacing='0' border='0' width='100%' height=20 class='C_Admin_table_bg'>";
    $img[a_img] .="<tr bgcolor='#7B7B7B'><td width=60% align=right>{$pn_img[p_button]}&nbsp;&nbsp;&nbsp;&nbsp;{$pn_img[n_button]}</td>";
    $img[a_img] .="<td width=40% align=right><a href='http://oldccc.com' target=_blank>oldccc.com</a></td></tr>";
    $img[a_img] .="</table>";
    return $img;

}


$pn_img = get_n_image($bo_table, $wr_id);


$view_image=view_img($bo_table,$wr_id);

echo $view_image[a_img];

$view_image[heightadd] = $view_image[height]+80;
?>


<script>
self.resizeTo(<?=$view_image[width]?>,<?=$view_image[heightadd]?>)
</script>





스킨 부분 처리
gblist.skin.php


<?
$image_width  = 110; // 이미지 폭
$image_height = 110; // 이미지 높이
$image_y = 60; // 본문글 출력세로크기,이미지크기 제외한 사이즈를 입력하세요
$content_font_size = "9pt";
?>

<?

// 확장자 분리 2005.03.25 ⓒⓒⓒ
function get_file_ext($filename) {

    $files = explode('.',$filename);
    $pointea = count($files);
    $cn = $pointea-1;

    $efile[1] = $files[$cn];


    if ($pointea > 2) {
        for ($i=0;$i<$cn;$i++) {
            $p = "";
            if ($i > 0) $p = ".";
            $filem .= $p+$files[$i];
            }
    } else {
        $filem = $files[0];
    }

    $efile[0] = $filem;

    return $efile;

}

?>
<script language="JavaScript">

    var imgObj = new Image();

    function showImgWin(imgName, imgWidth, imgHeight, content) {
        imgObj.src = imgName;
        imgObj.ccc = content;
        setTimeout("createImgWin(imgObj)", 100);
    }

    function createImgWin(imgObj) {

        if (! imgObj.complete) {
            setTimeout("createImgWin(imgObj)", 100);
            return;
        }
        var content = '';
       
        imageWin = window.open("", "imageWin", "width=" + imgObj.width + ",height=" + (parseInt(imgObj.height)+<?=$image_y?>));
        imageWin.document.write("<html><body style='margin:0'>");
        imageWin.document.write("<table cellpadding='0' cellspacing='0' width=500><tr><td>");
        imageWin.document.write("<a href='#' onclick='window.close()'><img src='" + imgObj.src + "' border=0 alt='클릭하면 닫힙니다.'></a>");
        imageWin.document.write("</td></tr></table><table BGCOLOR=#FFFFFF HEIGHT=100 width=500><tr><td valign='top'>");
        imageWin.document.write("<p><a><span style='font-family:돋움;font-size:<?=$content_font_size?>;'>"+ imgObj.ccc +"</span></a></p>");
        imageWin.document.write("</td></tr></table>");
        imageWin.document.write("</body><html>");
        imageWin.document.title = ("원본 보기")
    }

    function chgImg(file_img,lure,file_content){
        layer=document.getElementById? document.getElementById("showimage") : document.all.showimage
        layer.innerHTML='<table width="'+w+'" border="1" cellspacing="1" cellpadding="1" bgcolor="#ffffff" style="border:1px solid #000000; padding:5px;" onClick="HideImg()"><tr><td><table width="100" border="0" cellspacing="0" cellpadding="0" ><tr><td height="1" bgcolor="#99CCFF" id=drag></td></tr><tr><td><img src="'+file_img+'" border="0" width="'+w+'" alt="클릭하면 이미지 닫힙니다" id=drag></td></tr><tr><td height="30" width="'+w+'" bgcolor="#99CCFF" id=drag><span class="style"><font color=#ffffff>&nbsp;'+file_content+'</font></td></tr></table></td></tr></table>'

        layer.style.visibility="visible"
    }

</script>

<link rel='stylesheet' href='<?=$board_skin?>/style.skin.css' type='text/css'>

<META http-equiv="imagetoolbar" content="no">

<table width='<?=$width?>' align=center><tr><td>

<table width=100% style="border-top-width:0; border-right-width:0; border-bottom-width:1; border-left-width:0; border-color:#E0DFDF; border-top-style:solid; border-left-style:solid; border-bottom-style:solid; border-right-style:solid;">
<tr>
    <form name=fcategory method=get action='./'>
    <input type=hidden name=doc value='<?=$doc?>'>
    <td width=50%>
        <? if ($is_category) { ?>
            <select name=ca_id onchange="location='<?=$category_location?>'+this.value;" class=select>
            <option value=''>전체</option>
            <?=$category_option?>
            </select>
        <? } ?>
    </td>
    </form>
    <td width=50% align=right><span class=etc>게시물 <?=nf($total_count)?>건</span>
<? if ($admin_href) { echo "<a href='$admin_href'> * </a>"; } ?>
</tr>
</table><br>


<?
// 번호에 이미지를 사용할 경우는 아래의 주석을 제거하고 $list[$i][num]의 내용을 수정후 사용하세요.
// if (!is_int($list[$i][num])) { $list[$i][num] = "<img src='$board_skin/img/arrow.gif'>"; }
?>
<table width=99% align=center style="border-top-width:0; border-right-width:0; border-bottom-width:1; border-left-width:0; border-color:#f7f7f7; border-top-style:solid; border-left-style:solid; border-bottom-style:solid; border-right-style:solid;">
<form name=frmgblist method='post' action='<?="./?doc=$cfg[bbs_dir]/gbdeleteall.php"?>'>
<input type=hidden name=bo_table value='<?=$bo_table?>'>
<input type=hidden name=sselect  value='<?=$sselect?>'>
<input type=hidden name=stext    value='<?=$stext?>'>
<input type=hidden name=spart    value='<?=$spart?>'>
<input type=hidden name=page    value='<?=$page?>'>
<tr>
<?
for ($i=0; $i<count($list); $i++) {

    $tr = "";
    if ($i && $i%$board[bo_gallery_width]==0) {
        $tr = "</tr><tr>";
    }
echo "$tr";


$viewfile = get_file_ext($list[$i]["wr_file1"]);

$viewfiles = "./data/file/$bo_table/".$viewfile[0]."_s.".$viewfile[1];

if (!file_exists($list[$i][file_image1])){
    $list[$i][file_image1] = "$board_skin/noimage.gif";
}else if(!file_exists($viewfiles)) {

    $wr["wr_file1"] = $list[$i]["wr_file1"];
    $dest_file=$list[$i][file_image1]; //원본파일 이름을 gbupdate.skin.php파일에서 사용하도록 정의
    include "$board_skin/gbupdate.skin.php";
}
?>

    <td width='<?=$td_width?>%' valign=top align=center>
        <table cellpadding=3 cellspacing=12 width="150" height="150" align=center style="border-top-width:1; border-right-width:1; border-bottom-width:1; border-left-width:1; border-color:#595959; border-top-style:solid; border-left-style:solid; border-bottom-style:solid; border-right-style:solid;">
        <tr>
            <td align=center valign=middle>
            <?
            // 큰 이미지 사이즈 얻기
            $limg = $list[$i][file_image1];
            if (file_exists($limg)) {
                $size = getimagesize($limg);
                echo "<a href=\"javascript:showImgWin('$limg', $size[0], $size[1], '".conv_content($list[$i][wr_content], $list[$i][wr_html])."');\">";
            }
            ?>
            <? $imgsize = get_image_ratio($viewfiles,$image_width,$image_height);
            ?>
            <img src='<?=$viewfiles?>' width='<?=$imgsize[width]?>' height='<?=$imgsize[height]?>' border=1 alt='<?=$list[$i][wr_subject]?>' style='border-color:#555555;'></a></td>
        </tr>
        </table>

        <table width=100%><tr><td height=25 align=center>
            <? if ($is_checkdelete) { ?><input type=checkbox name=chk_wr_id[] value='<?=$list[$i][wr_id]?>'><? } ?> <a href='<?=$list[$i][href]?>'><? if ($list[$i][is_notice]) echo "<b>"; ?><?=cut_str($list[$i][subject],10)?><? if ($list[$i][is_notice]) echo "</b>"; ?></a> <?=$list[$i][icon_new]?>
            <span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span>
        </td></tr></table>
    </td>

<?
}

if (count($list) == 0) { echo "<tr><td colspan=8 align=center height=100 class='content contentbg'>자료가 없습니다.</td></tr>"; }
?>

</form>
</tr>
</table>
<div align=right><a href='http://oldccc.com/' target='_blank'>Powered by ⓒⓒⓒ</a></div>

<table width=100%>
<tr>
    <td width=50%>
        <? if ($list_href) { echo "<a href='$list_href'><img src='$board_skin/list.gif' border=0 alt='목록' align=absmiddle></a>"; } ?>
        <? if ($write_href) { echo "<a href='$write_href'><img src='$board_skin/write.gif' border=0 alt='글쓰기' align=absmiddle></a>"; } ?>
        <? if ($is_checkdelete) { ?>
        <a href='javascript:all_checked(true);'><img src='<?="$board_skin/allchk.gif"?>' border=0 alt='전체선택' align=absmiddle></a>
        <a href='javascript:all_checked(false);'><img src='<?="$board_skin/allunchk.gif"?>' border=0 alt='선택해제' align=absmiddle></a>
        <a href='javascript:all_delete();'><img src='<?="$board_skin/allchkdel.gif"?>' border=0 alt='선택삭제' align=absmiddle></a>
        <script language='javascript'>
            function all_checked(sw)
            {
                var f = document.frmgblist;

                for (var i=0; i<f.length; i++) {
                    if (f.elements[i].name == 'chk_wr_id[]') {
                        f.elements[i].checked = sw;
                    }
                }
            }

            function all_delete()
            {
                var f = document.frmgblist;
                var chk_count = 0;

                for (var i=0; i<f.length; i++) {
                    if (f.elements[i].name == 'chk_wr_id[]' && f.elements[i].checked) {
                        chk_count++;
                    }
                }

                if (!chk_count) {
                    alert("게시물을 하나 이상 선택하세요.");
                    return;
                }

                if (!confirm("선택한 게시물을 정말 삭제 하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다")) {
                    return;
                }

                f.submit();
            }
        </script>
        <? } ?>
    </td>
    <form name=fsearch method=get action='./'>
    <input type=hidden name=doc value='<?=$doc?>'>
    <input type=hidden name=bo_table value='<?=$bo_table?>'>
    <td width=50% align=right>
        <select name=sselect class=select>
            <option value='wr_subject|wr_content'>제목+내용</option>
            <option value='wr_name'>이름</option>
            <option value='wr_num'>번호</option>
            <option value='wr_datetime'>날짜</option>
            <option value='wr_subject'>제목</option>
            <option value='wr_content'>내용</option>
            <option value='wr_hit'>읽음</option>
            <? if ($is_good) { ?><option value='wr_good'>추천</option><? } ?>
            <? if ($is_nogood) { ?><option value='wr_nogood'>비추천</option><? } ?>
        </select>
        <input type=text name=stext size=10 required itemname='검색어' value='<?=$stext?>' >
        <select name=soperator class=select>
            <option value='0'>OR</option>
            <option value='1'>AND</option>
        </select>
        <input type=image src='<?="$board_skin/search.gif"?>' border=0 alt='검색' align=absmiddle>
    </td>
    </form>
</tr>
</table>

<? if ($stext) { ?>
    <script language='JavaScript'>
        if ('<?=$sselect?>' == 'ca_id') {
            document.fcategory.ca_id.value = '<?=$stext?>';
            document.fsearch.stext.value = '';
        } else {
            document.fsearch.sselect.value  = '<?=$sselect?>';
            document.fsearch.soperator.value = '<?=(int)$soperator?>';
        }
    </script>
<? } ?>

<table width=100%>
<tr>
    <td align=right>
        <? if ($prev_spart_href) { echo "<a href='$prev_spart_href'><img src='$board_skin/spartprev.gif' border=0 alt='이전검색'></a>"; } ?>
        <?=$write_pages?>
        <? if ($next_spart_href) { echo "<a href='$next_spart_href'><img src='$board_skin/spartnext.gif' border=0 alt='다음검색'></a>"; } ?>
    </td>
</tr>
</table>

</td></tr></table>
추천
0
  • 복사

댓글 전체

http://arttoart.pe.kr/gnu3/?doc=bbs/gnuboard.php&bo_table=artist

간만에 리뉴얼 할려고 하는데 이런현상이


Fatal error: Call to undefined function: get_image_ratio() in /home/hosting_users/art0644/www/gnu3/bbs/skin/board/gallery_ccc/gblist.skin.php on line 153
© SIRSOFT
현재 페이지 제일 처음으로