본문이미지새창열기 다른버전(오달수님소스짜집기) 정보
본문이미지새창열기 다른버전(오달수님소스짜집기)본문
안녕하세요 짜집퍼입니다.
본문이미지새창열기 다른버전(오달수님소스짜집기)하나더 준비했습니다
소스지저분합니다....
<script language='JavaScript' >
// 이미지의 크기에 따라 새창의 크기가 변경됩니다.
// zzzz님께서 알려주셨습니다. 2005/04/12, Re 2006.04.30 : 프린트추가, 마지막수정 2006.07.17
function image_window(img, w, h)
{
var img, w, h;
if(!w) {
if(img.tmp_width) { // this 1
w = img.tmp_width;
h = img.tmp_height;
img = img.src;
} else if(!img.width) { // this 2
var imgObj = new Image();
imgObj.src = img;
img = imgObj.src;
w = imgObj.width;
h = imgObj.height;
} else { // url
w = img.width;
h = img.height;
img = img.src;
}
}
// 로딩되지(읽지) 않은 이미지의 오류. beta 2006.06.26
if(!parseInt(w)) {
//img = img.src;
w = img.width;
h = img.height;
}
wsw = window.screen.width;
wsh = window.screen.height;
winl = (w >= wsw) ? 0 : (wsw-w)/2;
wint = (h >= wsh) ? 0 : (wsh-h)/3;
if(!g4_charset) var g4_charset = 'euc-kr';
win=window.open('','newWindow','width='+w+',height='+h+',top='+wint+',left='+winl+',=scrollbars=no,resizable=no,status=no');
win.document.open();
win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+g4_charset+"'>\n");
win.document.write ("<title>이미지 "+w+" x "+h+"</title> \n");
if(!winl || !wint) {
var js_url = "<script language='JavaScript'> \n";
js_url += "<!-- \n";
js_url += "var is_ie=document.all; \n";
js_url += "var isdrag=false; \n";
js_url += "var x,y,dobj; \n";
js_url += "function movemouse(e) { \n";
js_url += "if (isdrag) { \n";
js_url += "dobj.style.left = is_ie ? tx + event.clientX - x : tx + e.clientX - x; \n";
js_url += "dobj.style.top = is_ie ? ty + event.clientY - y : ty + e.clientY - y; \n";
js_url += "return false; }} \n";
js_url += "function selectmouse(e) { \n";
js_url += "var fobj = is_ie ? event.srcElement : e.target; \n";
js_url += "var topelement = is_ie ? 'BODY' : 'HTML'; \n";
js_url += "while (fobj.tagName != topelement && fobj.className != 'dragme') { \n";
js_url += "fobj = is_ie ? fobj.parentElement : fobj.parentNode; } \n";
js_url += "if (fobj.className=='dragme') { \n";
js_url += "isdrag = true; \n";
js_url += "dobj = fobj; \n";
js_url += "tx = parseInt(dobj.style.left+0); \n";
js_url += "ty = parseInt(dobj.style.top+0); \n";
js_url += "x = is_ie ? event.clientX : e.clientX; \n";
js_url += "y = is_ie ? event.clientY : e.clientY; \n";
// js_url += "document.onmousemove=movemouse; \n";
js_url += "return false; }} \n";
// js_url += "document.onmousedown=selectmouse; \n";
// js_url += "document.onmouseup=new Function('isdrag=false'); \n";
js_url += "//--> \n";
js_url += "</"+"script> \n";
win.document.write (js_url);
var click = "onclick='window.close();' ondragstart=selectmouse() ondragover=movemouse() style='cursor:pointer' title='\n마우스 왼쪽 버튼을 누른 채 이동하세요. \n\n 창닫기는 그림을 클릭하세요'";
} else
var click = "onclick='window.close();' style='cursor:pointer'";
win.document.write ("<style>.dragme{position:relative;}</style>\n");
win.document.write ("</head> \n\n");
win.document.write ("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' bgcolor='#ffffff'> \n");
win.document.write ("<table cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td align='center'><img src='"+img+"' name='imgs' width='"+w+"' height='"+h+"' oncontextmenu=\"if(confirm('프린트 하겠습니까?')){window.print(); return false;}\"; "+click+" class='dragme'></td></tr></table> \n");
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
</script>
<?
// 파일 출력
for($i=0; $i<=count($view[file]); $i++) {
if($view[file][$i][view])
###############################################
$img_width=100;
$f_type=""; $f_style=""; $f_path=""; $f_file ="";
// echo"파일타입: {$view[file][$i][image_type]}<br>";
$f_type=$view[file][$i][image_type];
if($f_type=='1' || $f_type=='2' || $f_type=='3' ||$f_type=='6' || $f_type=='7') $f_style="img";
else if($f_type=='4') $f_style="movie_img";//쭉..형태추가
else if($f_type=='0') $f_style="file_link";
$f_file = urlencode($view[file][$i][file]);
$f_path="{$view[file][$i][path]}";
###############################################
// if($view[file][$i][source])
if($view[file][$i][source] && $i==0) // 이미지출력변수
{$view[file][$i][href]="$f_path/$f_file";
// $image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
$image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
if(preg_match("/\.(jp[e]?g|tif|bmp|gif|png)$/i","$f_file")
&& file_exists("$f_path/$f_file")&& $f_style=="img")
{//이미지면 끝
// echo"<a href='{$view[file][$i][href]}'><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
//echo"<a href=$image[$i]><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
//echo"<a href=# onclick=image_window('$image[$i]') style='cursor:pointer'><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
echo"<a href=# onclick=images_window('$image[$i]') style='cursor:pointer'><img src='$f_path/$f_file' width='300' height=300 border='1'><br>";
echo"</a><br>";
echo"이미지크기:<font color='red'>{$view[file][$i][image_width]} x {$view[file][$i][image_height]}</font><br>";
echo"이미지설명:<font color='blue'>{$view[file][$i][bf_content]}</font><br>";
echo"<br>";
}else
echo $view[file][$i][view];
}//if 다운소스가 존재하면
###############################################
}//for 끝
?>
<?
// 파일 출력
for($i=0; $i<=count($view[file]); $i++) {
if($view[file][$i][view])
###############################################
$img_width=100;
$f_type=""; $f_style=""; $f_path=""; $f_file ="";
// echo"파일타입: {$view[file][$i][image_type]}<br>";
$f_type=$view[file][$i][image_type];
if($f_type=='1' || $f_type=='2' || $f_type=='3' ||$f_type=='6' || $f_type=='7') $f_style="img";
else if($f_type=='4') $f_style="movie_img";//쭉..형태추가
else if($f_type=='0') $f_style="file_link";
$f_file = urlencode($view[file][$i][file]);
$f_path="{$view[file][$i][path]}";
###############################################
// if($view[file][$i][source])
if($view[file][$i][source] && $i==1) // 이미지출력변수
{$view[file][$i][href]="$f_path/$f_file";
// $image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
$image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
if(preg_match("/\.(jp[e]?g|tif|bmp|gif|png)$/i","$f_file")
&& file_exists("$f_path/$f_file")&& $f_style=="img")
{//이미지면 끝
// echo"<a href='{$view[file][$i][href]}'><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
//echo"<a href=$image[$i]><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
echo"<a href=# onclick=image_window('$image[$i]') style='cursor:pointer'><img src='$f_path/$f_file' width='300' height=300 border='1'><br>";
echo"</a><br>";
echo"이미지크기:<font color='red'>{$view[file][$i][image_width]} x {$view[file][$i][image_height]}</font><br>";
echo"이미지설명:<font color='blue'>{$view[file][$i][bf_content]}</font><br>";
echo"<br>";
}else
echo $view[file][$i][view];
}//if 다운소스가 존재하면
###############################################
}//for 끝
?>
위소스는 " 첫번째,두번째파일이 그림파일일때 가로세로 300으로 출력하고 이미지를 클릭하면 새창으로
띄워라이고 만약이미지가 아니면 보이지마라" 입니다.
본문이미지새창열기 다른버전(오달수님소스짜집기)하나더 준비했습니다
소스지저분합니다....
<script language='JavaScript' >
// 이미지의 크기에 따라 새창의 크기가 변경됩니다.
// zzzz님께서 알려주셨습니다. 2005/04/12, Re 2006.04.30 : 프린트추가, 마지막수정 2006.07.17
function image_window(img, w, h)
{
var img, w, h;
if(!w) {
if(img.tmp_width) { // this 1
w = img.tmp_width;
h = img.tmp_height;
img = img.src;
} else if(!img.width) { // this 2
var imgObj = new Image();
imgObj.src = img;
img = imgObj.src;
w = imgObj.width;
h = imgObj.height;
} else { // url
w = img.width;
h = img.height;
img = img.src;
}
}
// 로딩되지(읽지) 않은 이미지의 오류. beta 2006.06.26
if(!parseInt(w)) {
//img = img.src;
w = img.width;
h = img.height;
}
wsw = window.screen.width;
wsh = window.screen.height;
winl = (w >= wsw) ? 0 : (wsw-w)/2;
wint = (h >= wsh) ? 0 : (wsh-h)/3;
if(!g4_charset) var g4_charset = 'euc-kr';
win=window.open('','newWindow','width='+w+',height='+h+',top='+wint+',left='+winl+',=scrollbars=no,resizable=no,status=no');
win.document.open();
win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+g4_charset+"'>\n");
win.document.write ("<title>이미지 "+w+" x "+h+"</title> \n");
if(!winl || !wint) {
var js_url = "<script language='JavaScript'> \n";
js_url += "<!-- \n";
js_url += "var is_ie=document.all; \n";
js_url += "var isdrag=false; \n";
js_url += "var x,y,dobj; \n";
js_url += "function movemouse(e) { \n";
js_url += "if (isdrag) { \n";
js_url += "dobj.style.left = is_ie ? tx + event.clientX - x : tx + e.clientX - x; \n";
js_url += "dobj.style.top = is_ie ? ty + event.clientY - y : ty + e.clientY - y; \n";
js_url += "return false; }} \n";
js_url += "function selectmouse(e) { \n";
js_url += "var fobj = is_ie ? event.srcElement : e.target; \n";
js_url += "var topelement = is_ie ? 'BODY' : 'HTML'; \n";
js_url += "while (fobj.tagName != topelement && fobj.className != 'dragme') { \n";
js_url += "fobj = is_ie ? fobj.parentElement : fobj.parentNode; } \n";
js_url += "if (fobj.className=='dragme') { \n";
js_url += "isdrag = true; \n";
js_url += "dobj = fobj; \n";
js_url += "tx = parseInt(dobj.style.left+0); \n";
js_url += "ty = parseInt(dobj.style.top+0); \n";
js_url += "x = is_ie ? event.clientX : e.clientX; \n";
js_url += "y = is_ie ? event.clientY : e.clientY; \n";
// js_url += "document.onmousemove=movemouse; \n";
js_url += "return false; }} \n";
// js_url += "document.onmousedown=selectmouse; \n";
// js_url += "document.onmouseup=new Function('isdrag=false'); \n";
js_url += "//--> \n";
js_url += "</"+"script> \n";
win.document.write (js_url);
var click = "onclick='window.close();' ondragstart=selectmouse() ondragover=movemouse() style='cursor:pointer' title='\n마우스 왼쪽 버튼을 누른 채 이동하세요. \n\n 창닫기는 그림을 클릭하세요'";
} else
var click = "onclick='window.close();' style='cursor:pointer'";
win.document.write ("<style>.dragme{position:relative;}</style>\n");
win.document.write ("</head> \n\n");
win.document.write ("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' bgcolor='#ffffff'> \n");
win.document.write ("<table cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td align='center'><img src='"+img+"' name='imgs' width='"+w+"' height='"+h+"' oncontextmenu=\"if(confirm('프린트 하겠습니까?')){window.print(); return false;}\"; "+click+" class='dragme'></td></tr></table> \n");
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
</script>
<?
// 파일 출력
for($i=0; $i<=count($view[file]); $i++) {
if($view[file][$i][view])
###############################################
$img_width=100;
$f_type=""; $f_style=""; $f_path=""; $f_file ="";
// echo"파일타입: {$view[file][$i][image_type]}<br>";
$f_type=$view[file][$i][image_type];
if($f_type=='1' || $f_type=='2' || $f_type=='3' ||$f_type=='6' || $f_type=='7') $f_style="img";
else if($f_type=='4') $f_style="movie_img";//쭉..형태추가
else if($f_type=='0') $f_style="file_link";
$f_file = urlencode($view[file][$i][file]);
$f_path="{$view[file][$i][path]}";
###############################################
// if($view[file][$i][source])
if($view[file][$i][source] && $i==0) // 이미지출력변수
{$view[file][$i][href]="$f_path/$f_file";
// $image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
$image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
if(preg_match("/\.(jp[e]?g|tif|bmp|gif|png)$/i","$f_file")
&& file_exists("$f_path/$f_file")&& $f_style=="img")
{//이미지면 끝
// echo"<a href='{$view[file][$i][href]}'><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
//echo"<a href=$image[$i]><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
//echo"<a href=# onclick=image_window('$image[$i]') style='cursor:pointer'><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
echo"<a href=# onclick=images_window('$image[$i]') style='cursor:pointer'><img src='$f_path/$f_file' width='300' height=300 border='1'><br>";
echo"</a><br>";
echo"이미지크기:<font color='red'>{$view[file][$i][image_width]} x {$view[file][$i][image_height]}</font><br>";
echo"이미지설명:<font color='blue'>{$view[file][$i][bf_content]}</font><br>";
echo"<br>";
}else
echo $view[file][$i][view];
}//if 다운소스가 존재하면
###############################################
}//for 끝
?>
<?
// 파일 출력
for($i=0; $i<=count($view[file]); $i++) {
if($view[file][$i][view])
###############################################
$img_width=100;
$f_type=""; $f_style=""; $f_path=""; $f_file ="";
// echo"파일타입: {$view[file][$i][image_type]}<br>";
$f_type=$view[file][$i][image_type];
if($f_type=='1' || $f_type=='2' || $f_type=='3' ||$f_type=='6' || $f_type=='7') $f_style="img";
else if($f_type=='4') $f_style="movie_img";//쭉..형태추가
else if($f_type=='0') $f_style="file_link";
$f_file = urlencode($view[file][$i][file]);
$f_path="{$view[file][$i][path]}";
###############################################
// if($view[file][$i][source])
if($view[file][$i][source] && $i==1) // 이미지출력변수
{$view[file][$i][href]="$f_path/$f_file";
// $image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
$image[$i] = "$g4[path]/data/file/$bo_table/".$view[file][$i][file];
if(preg_match("/\.(jp[e]?g|tif|bmp|gif|png)$/i","$f_file")
&& file_exists("$f_path/$f_file")&& $f_style=="img")
{//이미지면 끝
// echo"<a href='{$view[file][$i][href]}'><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
//echo"<a href=$image[$i]><img src='$f_path/$f_file' width='$img_width' border='0'><br>";
echo"<a href=# onclick=image_window('$image[$i]') style='cursor:pointer'><img src='$f_path/$f_file' width='300' height=300 border='1'><br>";
echo"</a><br>";
echo"이미지크기:<font color='red'>{$view[file][$i][image_width]} x {$view[file][$i][image_height]}</font><br>";
echo"이미지설명:<font color='blue'>{$view[file][$i][bf_content]}</font><br>";
echo"<br>";
}else
echo $view[file][$i][view];
}//if 다운소스가 존재하면
###############################################
}//for 끝
?>
위소스는 " 첫번째,두번째파일이 그림파일일때 가로세로 300으로 출력하고 이미지를 클릭하면 새창으로
띄워라이고 만약이미지가 아니면 보이지마라" 입니다.
추천
0
0
댓글 3개
참고로 제로보드에서 쓰던 새창열기 자바스크립트인데요 여기서 쓸라 하니까 힘드네요
변경해줄 고수님계시면 좋은듯싶네요
소스올립니다
<html>
<head>
<title>include</title>
<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(100, 100);
width = 100 - (document.body.clientWidth - document.images[0].width);
height = 100 - (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 * (document.images[0].width/document.body.clientWidth - 1)), (window.event.clientY * (document.images[0].height/document.body.clientHeight - 1 )) );
}
</script>
<body topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' onLoad="fitWindowSize()" onmousemove="move();" >
<A href=# onclick=window.close()>
<?
$file="../".$file;
?>
<img src=<?=$file?> border=0 ></a>
</body>
</head>
</html>
변경해줄 고수님계시면 좋은듯싶네요
소스올립니다
<html>
<head>
<title>include</title>
<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(100, 100);
width = 100 - (document.body.clientWidth - document.images[0].width);
height = 100 - (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 * (document.images[0].width/document.body.clientWidth - 1)), (window.event.clientY * (document.images[0].height/document.body.clientHeight - 1 )) );
}
</script>
<body topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' onLoad="fitWindowSize()" onmousemove="move();" >
<A href=# onclick=window.close()>
<?
$file="../".$file;
?>
<img src=<?=$file?> border=0 ></a>
</body>
</head>
</html>
오~ 앞으로 발전하실 끼가 겁나게 보입니다...^^;;
올 크리스마스전에..
아이디 기억하고 있다가.. 몇가지 선물을 드려야겠네요..^^;;
올 크리스마스전에..
아이디 기억하고 있다가.. 몇가지 선물을 드려야겠네요..^^;;
오~ 말씀만들어도 힘이납니다...
감격의눈물...감사감사~
감격의눈물...감사감사~