본문 바로가기

Tip&Tech/Zeroboard

게시물 중 이미지 클릭하면 새창으로 이미지 보여주기

1. 아래와 같은 파일(view_image.php)을 하나 만들어 제로보드(bbs)폴더에 업로드합니다.
<html>
<head>
<title>Screen Shot</title>
<meta http-equiv=Content-Type content=text/html; charset=EUC-KR>
</head>
<script language="javascript">
function processKey()
{
        if( (event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) ||
        (event.keyCode >= 112 && event.keyCode <= 123) || event.keyCode == 8)
            {
        event.keyCode = 0;
        event.cancelBubble = true;
        event.returnValue = false;
            }
}
document.onkeydown = processKey;
</script>

<script language="javascript">
var isNav4, isIE4;
var windowX, windowY;
var bLargeImage = 0;
var x,y;
if (parseInt(navigator.appVersion.charAt(0)) >= 4)
{
    isNav4 = (navigator.appName == "Netscape") ? 1 : 0;
    isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
}
function fitWindowSize()
{
    if (isNav4) {
        window.innerWidth = document.layers[0].document.images[0].width;
        window.innerHeight = document.layers[0].document.images[0].height;
    }
    if (isIE4) {
        window.resizeTo(500, 500);
        width = 500 - (document.body.clientWidth -  document.images[0].width);
        height = 500 - (document.body.clientHeight -  document.images[0].height)
        windowX = (window.screen.width-width)/2;
        windowY = (window.screen.height-height)/2;
        if(width>screen.width){
            width = screen.width;
            windowX = 0;
            bLargeImage = 1;
        }
        if(height>screen.height-50){
            height = screen.height-50;
            windowY = 0;
            bLargeImage = 1;
        }
        x = width/2;
        y = height/2;
        window.moveTo(windowX,windowY);
        window.resizeTo(width, height);
    }
}
function move()
{
    if(bLargeImage)
    window.scroll(window.event.clientX - 50,window.event.clientY -50);
}
</script>
<body onLoad="fitWindowSize()" onmousemove="move();" leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>
<A href=# onclick=window.close()><img src=<?=$filename?> border=0></a>
</body>
</html>


2. 다음의 수정을 합니다.
2.1. 수정해야 되는 파일
/제로보드 설치폴더/include/list_check.php

2.2. 수정해야 되는 부분
수정전
$upload_image1=$upload_image2="";
if(eregi("\.jpg",$file_name1)||eregi("\.gif",$file_name1)||eregi("\.png",$file_name1)) $upload_image1="<img src=$data[file_name1]
border=0 name=zb_target_resize style=\"cursor:hand\" onclick=window.open(this.src)><br>";
if(eregi("\.jpg",$file_name2)||eregi("\.gif",$file_name2)||eregi("\.png",$file_name2)) $upload_image2="<img src=$data[file_name2]
border=0 name=zb_target_resize style=\"cursor:hand\" onclick=window.open(this.src)><br>";


수정후
if(eregi("\.jpg",$file_name1)||eregi("\.gif",$file_name1)||eregi("\.png",$file_name1)) $upload_image1="<img src=$data[file_name1]
border=0 name=zb_target_resize style=\"cursor:hand\"
onclick=window.open('view_image.php?filename=$data[file_name1]','screenshot1','width=$image_info[0], height=$image_info[1],scrollbars=no,toolbars=no')><br>";

if(eregi("\.jpg",$file_name2)||eregi("\.gif",$file_name2)||eregi("\.png",$file_name2)) $upload_image2="<img src=$data[file_name2]
border=0 name=zb_target_resize style=\"cursor:hand\"
onclick=window.open('view_image.php?filename=$data[file_name2]','screenshot2','width=$image_info[0], height=$image_info[1],scrollbars=no,toolbars=no')><br>";