스크롤 되는 썸네일이 겹쳐지는 부분이 생기는데 조언 좀 부탁해요 정보
스크롤 되는 썸네일이 겹쳐지는 부분이 생기는데 조언 좀 부탁해요본문
오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.
오류 주소 : http://makingbook.kr/bbs/board.php?bo_table=z1_2&wr_id=260&page=
갤러리 스킨 적용 중 스크롤 되는 썸네일이 겹쳐져서 스크롤 되는 현상이 있습니다
아래소스 수정 좀 부탁드립니다.
<?
function UnsharpMask($img, $amount, $radius, $threshold) {
// Attempt to calibrate the parameters to Photoshop:
if ($amount > 500) $amount = 500;
$amount = $amount * 0.016;
if ($radius > 50) $radius = 50;
$radius = $radius * 2;
if ($threshold > 255) $threshold = 255;
$radius = abs(round($radius)); // Only integers make sense.
if ($radius == 0) { return $img; imagedestroy($img); break; }
$w = imagesx($img); $h = imagesy($img);
$imgCanvas = $img;
$imgCanvas2 = $img;
$imgBlur = imagecreatetruecolor($w, $h);
// Gaussian blur matrix:
// 1 2 1
// 2 4 2
// 1 2 1
// Move copies of the image around one pixel at the time and merge them with weight
// according to the matrix. The same matrix is simply repeated for higher radii.
for ($i = 0; $i < $radius; $i++)
{
imagecopy ($imgBlur, $imgCanvas, 0, 0, 1, 1, $w - 1, $h - 1); // up left
imagecopymerge ($imgBlur, $imgCanvas, 1, 1, 0, 0, $w, $h, 50); // down right
imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 1, 0, $w - 1, $h, 33.33333); // down left
imagecopymerge ($imgBlur, $imgCanvas, 1, 0, 0, 1, $w, $h - 1, 25); // up right
imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 1, 0, $w - 1, $h, 33.33333); // left
imagecopymerge ($imgBlur, $imgCanvas, 1, 0, 0, 0, $w, $h, 25); // right
imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 20 ); // up
imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 16.666667); // down
imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 0, $w, $h, 50); // center
}
$imgCanvas = $imgBlur;
// Calculate the difference between the blurred pixels and the original
// and set the pixels
for ($x = 0; $x < $w; $x++)
{ // each row
for ($y = 0; $y < $h; $y++)
{ // each pixel
$rgbOrig = ImageColorAt($imgCanvas2, $x, $y);
$rOrig = (($rgbOrig >> 16) & 0xFF);
$gOrig = (($rgbOrig >> 8) & 0xFF);
$bOrig = ($rgbOrig & 0xFF);
$rgbBlur = ImageColorAt($imgCanvas, $x, $y);
$rBlur = (($rgbBlur >> 16) & 0xFF);
$gBlur = (($rgbBlur >> 8) & 0xFF);
$bBlur = ($rgbBlur & 0xFF);
// When the masked pixels differ less from the original
// than the threshold specifies, they are set to their original value.
$rNew = (abs($rOrig - $rBlur) >= $threshold) ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) : $rOrig;
$gNew = (abs($gOrig - $gBlur) >= $threshold) ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) : $gOrig;
$bNew = (abs($bOrig - $bBlur) >= $threshold) ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) : $bOrig;
if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew))
{
$pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew);
ImageSetPixel($img, $x, $y, $pixCol);
}
}
}
return $img;
}
?>
<?
//썸네일 코드 시작
$data_path = $g4['path'] . "/data/file/{$bo_table}";//라이브러리 파일 참조
$thumb_path = $data_path . '/thumbOpen';
$thumb_path2 = $data_path . '/thumbOpen2';
//파일 뽑기
$sql = " select bf_file, bf_source, bf_content from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 100 ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
if($i==0) {
$view_one = "{$thumb_path2}/{$row['bf_file']}";
$view_one_content = $rowi['bf_content'];
}
if($i != 0 && $i % 6 == 0) echo "</tr><tr><td colspan='3' style='height:7px;'></td></tr><tr>";
if($i % 6 != 0) echo "<td width=10></td>";
$view_w = 560; //썸네일 가로사이즈
$view_h = 420; //썸네일 세로사이즈
$sch_q = 100; //썸네일 퀼리티
if (!is_dir($thumb_path2)) {
@mkdir($thumb_path2, 0707);
@chmod($thumb_path2, 0707);
}
if (!is_dir($thumb_path)) {
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
}
$filename = $row[bf_file]; //파일명
$thumb2 = $thumb_path2.'/'.$filename; //썸네일
if (!file_exists($thumb2)) { //view 용 이미지 생성
$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_h / $size[1];
//$width = (int)($size[0] * $rate);
$width = 560; //가로 사이즈 고정
//echo "rate : $rate ,width : $width, $height : $board[bo_2] <br>";
if($width <= $view_w) { //width가 지정된 사이즈보다 작을경우 rate 비율로 썸네일 생성
$dst = imagecreatetruecolor($width, $view_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $view_h, $size[0], $size[1]);
imagejpeg($dst, $thumb_path2.'/'.$filename, $sch_q);
} else {
$rate = $view_w / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($view_w, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path2.'/'.$filename, $sch_q);
}
chmod($thumb_path2.'/'.$filename, 0707);
}
}
$view_w = 88; //썸네일 가로사이즈
$view_h = 66; //썸네일 세로사이즈
$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_h / $size[1];
//$width = (int)($size[0] * $rate);
$width = 88;
//echo "rate : $rate ,width : $width, $height : $board[bo_2] <br>";
if($width <= $view_w) { //width가 지정된 사이즈보다 작을경우 rate 비율로 썸네일 생성
$dst = imagecreatetruecolor($width, $view_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $view_h, $size[0], $size[1]);
$dst = UnsharpMask($dst, 80, 0.5, 3);
imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);
} else {
$rate = $view_w / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($view_w, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);
$dst = UnsharpMask($dst, 80, 0.5, 3);
imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);
}
chmod($thumb_path.'/'.$filename, 0707);
}
}
}
?>
<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();
}
//-->
function myimage_window(img)
{
var myimg = new Image();
myimg.src=img;
//var w = img.tmp_width;
//var h = img.tmp_height;
var w = myimg.width;
var h = myimg.height;
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/3;
if (w >= screen.width) {
winl = 0;
h = (parseInt)(w * (h / w));
}
if (h >= screen.height) {
wint = 0;
w = (parseInt)(h * (w / h));
}
var js_url = "<script language='JavaScript1.2'> \n";
js_url += "<!-- \n";
js_url += "var ie=document.all; \n";
js_url += "var nn6=document.getElementById&&!document.all; \n";
js_url += "var isdrag=false; \n";
js_url += "var x,y; \n";
js_url += "var dobj; \n";
js_url += "function movemouse(e) \n";
js_url += "{ \n";
js_url += " if (isdrag) \n";
js_url += " { \n";
js_url += " dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; \n";
js_url += " dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y; \n";
js_url += " return false; \n";
js_url += " } \n";
js_url += "} \n";
js_url += "function selectmouse(e) \n";
js_url += "{ \n";
js_url += " var fobj = nn6 ? e.target : event.srcElement; \n";
js_url += " var topelement = nn6 ? 'HTML' : 'BODY'; \n";
js_url += " while (fobj.tagName != topelement && fobj.className != 'dragme') \n";
js_url += " { \n";
js_url += " fobj = nn6 ? fobj.parentNode : fobj.parentElement; \n";
js_url += " } \n";
js_url += " if (fobj.className=='dragme') \n";
js_url += " { \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 = nn6 ? e.clientX : event.clientX; \n";
js_url += " y = nn6 ? e.clientY : event.clientY; \n";
js_url += " document.onmousemove=movemouse; \n";
js_url += " return false; \n";
js_url += " } \n";
js_url += "} \n";
js_url += "document.onmousedown=selectmouse; \n";
js_url += "document.onmouseup=new Function('isdrag=false'); \n";
js_url += "//--> \n";
js_url += "</"+"script> \n";
var settings;
if (g4_is_gecko) {
settings ='width='+(w+10)+',';
settings +='height='+(h+10)+',';
} else {
settings ='width='+w+',';
settings +='height='+h+',';
}
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=no,';
settings +='resizable=yes,';
settings +='status=no';
win=window.open("","image_window",settings);
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");
var size = "이미지 사이즈 : "+w+" x "+h;
win.document.write ("<title>"+size+"</title> \n");
if(w >= screen.width || h >= screen.height) {
win.document.write (js_url);
var click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n\n 이미지 사이즈가 화면보다 큽니다. \n 왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요. \n\n 더블 클릭하면 닫혀요. '";
}
else
var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '";
win.document.write ("<style>.dragme{position:relative;}</style> \n");
win.document.write ("</head> \n\n");
win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n");
win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
image_directory = ""; //배경이미지 경로
clear = new Image(); clear.src = image_directory + "./img/blank.gif";
// -->
</SCRIPT>
<table cellspacing="0" cellpadding="0" border="0" align="center" valign='top'>
<tr>
<td align="center" valign="top" bgcolor=white>
<div style='width:550px;position:relative;filter:progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=0.25,wipestyle=0,motion=forward);' align="center" id="loadarea"><img id='view_one' src="<?=$view_one?>" border="0"><br>
<span id='img_detail' align='center'><?=$view_one_content?></span><br><br></div>
<div style='display:none'><img id = "hidden_img" src='<?=$view_one?>'></div>
</td>
</tr>
<tr>
<!--작은사진목록-->
<td style="padding:4 0 4 0px;" width="640" height="120" align="center" valign="top">
<script type="text/javascript">
var sliderwidth="560px" //스크롤 가로 사이즈
var sliderheight="67px" //스크롤 세로 사이즈
var slidespeed="3"
slidebgcolor="#ffffff" //스크롤 배경 색상
//var leftarrowimage = "$board_skin_path/img/img/arrow_l.gif"
//var rightarrowimage = "$board_skin_path/img/img/arrow_r.gif"
var leftarrowimage = "<?=$board_skin_path?>/img/previous.png"
var rightarrowimage = "<?=$board_skin_path?>/img/next.png"
var leftrightslide=new Array()
var finalslide=''
<?
$sql = " select bf_file, bf_source, bf_content from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 100 ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$filename = $row[bf_file]; //파일명
$file = $data_path.'/'.$filename; //원본
$thumb = $thumb_path.'/'.$filename; //썸네일
?>
leftrightslide[<?=$i?>]="<a href='javascript:void(0)'><img src='<?=$thumb?>' border=0 onMouseOver=\"showBodyImage('<?=$thumb_path2?>/<?=$filename?>','<?=$file?>', '<?=$row[bf_content]?>')\" onClick=\"myimage_window('<?=$file?>')\"></A>";
<?
}
?>
var imagegap=" "
var slideshowgap=0
var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide
var righttime,lefttime
function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenuorange
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
//window.onload=fillup
if (!window.addEventListener){
window.attachEvent('onload', fillup);
} else {
window.addEventListener('load', fillup, false);
}
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}
function slideright(){
if (iedom){
if (parseInt(cross_slide.style.left)<(actualwidth+8))
cross_slide.style.left=parseInt(cross_slide.style.left)+copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth*(-1)+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)<(actualwidth+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)+copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth*(-1)+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}
function right(){
if(lefttime){
clearInterval(lefttime)
clearInterval(righttime)
righttime=setInterval("slideright()",30)
}
}
function left(){
if(righttime){
clearInterval(lefttime)
clearInterval(righttime)
lefttime=setInterval("slideleft()",30)
}
}
document.write('<table width='+sliderwidth+' border="0" align="center" cellspacing="0" cellpadding="0">');
document.write('<tr><td align=center valign=middle width=20><img src='+leftarrowimage+' onMouseover="right(); copyspeed=5" onMouseout="copyspeed=3" style="cursor:hand"></td>')
if (iedom||document.layers){
with (document){
document.write('<td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=3">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenuorange" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td>')
}
}
document.write('<td width="20" align=center valign=middle><img src='+rightarrowimage+' onMouseover="left();copyspeed=5" onMouseout="copyspeed=3" style="cursor:hand"></td></tr></table>')
function showBodyImage(url, url2, content) {
//imagearea = document.getElementById("loadarea");
//imageHTML = "<img src='" + url + "' boarder=0 style=\"filter:progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=0.25,wipestyle=0,motion=forward);\" ><br><center>" + content + "</center>";
bodyImage = document.getElementById("view_one");
hiddenImage = document.getElementById("hidden_img");
view_one.src = url;
hiddenImage.src = url2;
view_detail = document.getElementById("img_detail");
view_detail.innerHTML = content;
//loadarea.innerHTML=imageHTML;
}
</script>
</td>
</tr>
</table>
오류 주소 : http://makingbook.kr/bbs/board.php?bo_table=z1_2&wr_id=260&page=
갤러리 스킨 적용 중 스크롤 되는 썸네일이 겹쳐져서 스크롤 되는 현상이 있습니다
아래소스 수정 좀 부탁드립니다.
<?
function UnsharpMask($img, $amount, $radius, $threshold) {
// Attempt to calibrate the parameters to Photoshop:
if ($amount > 500) $amount = 500;
$amount = $amount * 0.016;
if ($radius > 50) $radius = 50;
$radius = $radius * 2;
if ($threshold > 255) $threshold = 255;
$radius = abs(round($radius)); // Only integers make sense.
if ($radius == 0) { return $img; imagedestroy($img); break; }
$w = imagesx($img); $h = imagesy($img);
$imgCanvas = $img;
$imgCanvas2 = $img;
$imgBlur = imagecreatetruecolor($w, $h);
// Gaussian blur matrix:
// 1 2 1
// 2 4 2
// 1 2 1
// Move copies of the image around one pixel at the time and merge them with weight
// according to the matrix. The same matrix is simply repeated for higher radii.
for ($i = 0; $i < $radius; $i++)
{
imagecopy ($imgBlur, $imgCanvas, 0, 0, 1, 1, $w - 1, $h - 1); // up left
imagecopymerge ($imgBlur, $imgCanvas, 1, 1, 0, 0, $w, $h, 50); // down right
imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 1, 0, $w - 1, $h, 33.33333); // down left
imagecopymerge ($imgBlur, $imgCanvas, 1, 0, 0, 1, $w, $h - 1, 25); // up right
imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 1, 0, $w - 1, $h, 33.33333); // left
imagecopymerge ($imgBlur, $imgCanvas, 1, 0, 0, 0, $w, $h, 25); // right
imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 20 ); // up
imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 16.666667); // down
imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 0, $w, $h, 50); // center
}
$imgCanvas = $imgBlur;
// Calculate the difference between the blurred pixels and the original
// and set the pixels
for ($x = 0; $x < $w; $x++)
{ // each row
for ($y = 0; $y < $h; $y++)
{ // each pixel
$rgbOrig = ImageColorAt($imgCanvas2, $x, $y);
$rOrig = (($rgbOrig >> 16) & 0xFF);
$gOrig = (($rgbOrig >> 8) & 0xFF);
$bOrig = ($rgbOrig & 0xFF);
$rgbBlur = ImageColorAt($imgCanvas, $x, $y);
$rBlur = (($rgbBlur >> 16) & 0xFF);
$gBlur = (($rgbBlur >> 8) & 0xFF);
$bBlur = ($rgbBlur & 0xFF);
// When the masked pixels differ less from the original
// than the threshold specifies, they are set to their original value.
$rNew = (abs($rOrig - $rBlur) >= $threshold) ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) : $rOrig;
$gNew = (abs($gOrig - $gBlur) >= $threshold) ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) : $gOrig;
$bNew = (abs($bOrig - $bBlur) >= $threshold) ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) : $bOrig;
if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew))
{
$pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew);
ImageSetPixel($img, $x, $y, $pixCol);
}
}
}
return $img;
}
?>
<?
//썸네일 코드 시작
$data_path = $g4['path'] . "/data/file/{$bo_table}";//라이브러리 파일 참조
$thumb_path = $data_path . '/thumbOpen';
$thumb_path2 = $data_path . '/thumbOpen2';
//파일 뽑기
$sql = " select bf_file, bf_source, bf_content from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 100 ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
if($i==0) {
$view_one = "{$thumb_path2}/{$row['bf_file']}";
$view_one_content = $rowi['bf_content'];
}
if($i != 0 && $i % 6 == 0) echo "</tr><tr><td colspan='3' style='height:7px;'></td></tr><tr>";
if($i % 6 != 0) echo "<td width=10></td>";
$view_w = 560; //썸네일 가로사이즈
$view_h = 420; //썸네일 세로사이즈
$sch_q = 100; //썸네일 퀼리티
if (!is_dir($thumb_path2)) {
@mkdir($thumb_path2, 0707);
@chmod($thumb_path2, 0707);
}
if (!is_dir($thumb_path)) {
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
}
$filename = $row[bf_file]; //파일명
$thumb2 = $thumb_path2.'/'.$filename; //썸네일
if (!file_exists($thumb2)) { //view 용 이미지 생성
$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_h / $size[1];
//$width = (int)($size[0] * $rate);
$width = 560; //가로 사이즈 고정
//echo "rate : $rate ,width : $width, $height : $board[bo_2] <br>";
if($width <= $view_w) { //width가 지정된 사이즈보다 작을경우 rate 비율로 썸네일 생성
$dst = imagecreatetruecolor($width, $view_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $view_h, $size[0], $size[1]);
imagejpeg($dst, $thumb_path2.'/'.$filename, $sch_q);
} else {
$rate = $view_w / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($view_w, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path2.'/'.$filename, $sch_q);
}
chmod($thumb_path2.'/'.$filename, 0707);
}
}
$view_w = 88; //썸네일 가로사이즈
$view_h = 66; //썸네일 세로사이즈
$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_h / $size[1];
//$width = (int)($size[0] * $rate);
$width = 88;
//echo "rate : $rate ,width : $width, $height : $board[bo_2] <br>";
if($width <= $view_w) { //width가 지정된 사이즈보다 작을경우 rate 비율로 썸네일 생성
$dst = imagecreatetruecolor($width, $view_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $view_h, $size[0], $size[1]);
$dst = UnsharpMask($dst, 80, 0.5, 3);
imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);
} else {
$rate = $view_w / $size[0];
$height = (int)($size[1] * $rate);
$dst = imagecreatetruecolor($view_w, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);
$dst = UnsharpMask($dst, 80, 0.5, 3);
imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);
}
chmod($thumb_path.'/'.$filename, 0707);
}
}
}
?>
<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();
}
//-->
function myimage_window(img)
{
var myimg = new Image();
myimg.src=img;
//var w = img.tmp_width;
//var h = img.tmp_height;
var w = myimg.width;
var h = myimg.height;
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/3;
if (w >= screen.width) {
winl = 0;
h = (parseInt)(w * (h / w));
}
if (h >= screen.height) {
wint = 0;
w = (parseInt)(h * (w / h));
}
var js_url = "<script language='JavaScript1.2'> \n";
js_url += "<!-- \n";
js_url += "var ie=document.all; \n";
js_url += "var nn6=document.getElementById&&!document.all; \n";
js_url += "var isdrag=false; \n";
js_url += "var x,y; \n";
js_url += "var dobj; \n";
js_url += "function movemouse(e) \n";
js_url += "{ \n";
js_url += " if (isdrag) \n";
js_url += " { \n";
js_url += " dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; \n";
js_url += " dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y; \n";
js_url += " return false; \n";
js_url += " } \n";
js_url += "} \n";
js_url += "function selectmouse(e) \n";
js_url += "{ \n";
js_url += " var fobj = nn6 ? e.target : event.srcElement; \n";
js_url += " var topelement = nn6 ? 'HTML' : 'BODY'; \n";
js_url += " while (fobj.tagName != topelement && fobj.className != 'dragme') \n";
js_url += " { \n";
js_url += " fobj = nn6 ? fobj.parentNode : fobj.parentElement; \n";
js_url += " } \n";
js_url += " if (fobj.className=='dragme') \n";
js_url += " { \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 = nn6 ? e.clientX : event.clientX; \n";
js_url += " y = nn6 ? e.clientY : event.clientY; \n";
js_url += " document.onmousemove=movemouse; \n";
js_url += " return false; \n";
js_url += " } \n";
js_url += "} \n";
js_url += "document.onmousedown=selectmouse; \n";
js_url += "document.onmouseup=new Function('isdrag=false'); \n";
js_url += "//--> \n";
js_url += "</"+"script> \n";
var settings;
if (g4_is_gecko) {
settings ='width='+(w+10)+',';
settings +='height='+(h+10)+',';
} else {
settings ='width='+w+',';
settings +='height='+h+',';
}
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars=no,';
settings +='resizable=yes,';
settings +='status=no';
win=window.open("","image_window",settings);
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");
var size = "이미지 사이즈 : "+w+" x "+h;
win.document.write ("<title>"+size+"</title> \n");
if(w >= screen.width || h >= screen.height) {
win.document.write (js_url);
var click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n\n 이미지 사이즈가 화면보다 큽니다. \n 왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요. \n\n 더블 클릭하면 닫혀요. '";
}
else
var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '";
win.document.write ("<style>.dragme{position:relative;}</style> \n");
win.document.write ("</head> \n\n");
win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n");
win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
image_directory = ""; //배경이미지 경로
clear = new Image(); clear.src = image_directory + "./img/blank.gif";
// -->
</SCRIPT>
<table cellspacing="0" cellpadding="0" border="0" align="center" valign='top'>
<tr>
<td align="center" valign="top" bgcolor=white>
<div style='width:550px;position:relative;filter:progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=0.25,wipestyle=0,motion=forward);' align="center" id="loadarea"><img id='view_one' src="<?=$view_one?>" border="0"><br>
<span id='img_detail' align='center'><?=$view_one_content?></span><br><br></div>
<div style='display:none'><img id = "hidden_img" src='<?=$view_one?>'></div>
</td>
</tr>
<tr>
<!--작은사진목록-->
<td style="padding:4 0 4 0px;" width="640" height="120" align="center" valign="top">
<script type="text/javascript">
var sliderwidth="560px" //스크롤 가로 사이즈
var sliderheight="67px" //스크롤 세로 사이즈
var slidespeed="3"
slidebgcolor="#ffffff" //스크롤 배경 색상
//var leftarrowimage = "$board_skin_path/img/img/arrow_l.gif"
//var rightarrowimage = "$board_skin_path/img/img/arrow_r.gif"
var leftarrowimage = "<?=$board_skin_path?>/img/previous.png"
var rightarrowimage = "<?=$board_skin_path?>/img/next.png"
var leftrightslide=new Array()
var finalslide=''
<?
$sql = " select bf_file, bf_source, bf_content from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 100 ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$filename = $row[bf_file]; //파일명
$file = $data_path.'/'.$filename; //원본
$thumb = $thumb_path.'/'.$filename; //썸네일
?>
leftrightslide[<?=$i?>]="<a href='javascript:void(0)'><img src='<?=$thumb?>' border=0 onMouseOver=\"showBodyImage('<?=$thumb_path2?>/<?=$filename?>','<?=$file?>', '<?=$row[bf_content]?>')\" onClick=\"myimage_window('<?=$file?>')\"></A>";
<?
}
?>
var imagegap=" "
var slideshowgap=0
var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide
var righttime,lefttime
function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenuorange
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
//window.onload=fillup
if (!window.addEventListener){
window.attachEvent('onload', fillup);
} else {
window.addEventListener('load', fillup, false);
}
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}
function slideright(){
if (iedom){
if (parseInt(cross_slide.style.left)<(actualwidth+8))
cross_slide.style.left=parseInt(cross_slide.style.left)+copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth*(-1)+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)<(actualwidth+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)+copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth*(-1)+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}
function right(){
if(lefttime){
clearInterval(lefttime)
clearInterval(righttime)
righttime=setInterval("slideright()",30)
}
}
function left(){
if(righttime){
clearInterval(lefttime)
clearInterval(righttime)
lefttime=setInterval("slideleft()",30)
}
}
document.write('<table width='+sliderwidth+' border="0" align="center" cellspacing="0" cellpadding="0">');
document.write('<tr><td align=center valign=middle width=20><img src='+leftarrowimage+' onMouseover="right(); copyspeed=5" onMouseout="copyspeed=3" style="cursor:hand"></td>')
if (iedom||document.layers){
with (document){
document.write('<td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=3">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenuorange" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td>')
}
}
document.write('<td width="20" align=center valign=middle><img src='+rightarrowimage+' onMouseover="left();copyspeed=5" onMouseout="copyspeed=3" style="cursor:hand"></td></tr></table>')
function showBodyImage(url, url2, content) {
//imagearea = document.getElementById("loadarea");
//imageHTML = "<img src='" + url + "' boarder=0 style=\"filter:progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=0.25,wipestyle=0,motion=forward);\" ><br><center>" + content + "</center>";
bodyImage = document.getElementById("view_one");
hiddenImage = document.getElementById("hidden_img");
view_one.src = url;
hiddenImage.src = url2;
view_detail = document.getElementById("img_detail");
view_detail.innerHTML = content;
//loadarea.innerHTML=imageHTML;
}
</script>
</td>
</tr>
</table>
댓글 전체