이현용님의 세로 이미지 + 제목 + 내용 최신글 스킨 썸네일 버전 (수정) 정보
최신글 이현용님의 세로 이미지 + 제목 + 내용 최신글 스킨 썸네일 버전 (수정)
관련링크
첨부파일
본문
이현용 님의 최신글 스킨이 맘에 들어 비록 보고 배우는 입장이지만
하나 만들어 봤습니다. (링크 참조)
썸네일 생성하는 코드는 기본 스킨중에 스킨게시판용에서 쓰인 코드를
뜯어와서 붙였습니다. 첫 번째 이미지만 썸네일로 생성합니다.
썸네일 가로길이, 세로 길이, 퀄리티, 글자수는 자신에게 맞게 설정하시구요
중간에 썸네일 이미지 생성디렉토리도 자신에게 맞게 고쳐 쓰시기 바랍니다. ^^
아참 이미지가 없을 경우를 대비해서 그누보드 기본 img 폴더에
noimage 파일 하나 넣어 두시길 바랍니다.
저는 png 이미지만 쓰는지라 코드엔 png로 들어가 있네요. 쓰시는걸로 수정 ^^
그리고 이미지가 표시되는 왼쪽 테이블 td 부분은
썸네일의 가로와 세로 길이로 자동 설정되게 했습니다.
아래는 코드 전문입니다.
지저분 + 짜집기 한거란게 확 티가 나네요 ^^;;
모양은 이현용님 스킨에서 일부러 다듬지 않았습니다.
제일 아래 테이블 부분만 조금씩 손 보면서 자신에게 맞게 다듬으시라고
테이블 모양은 원본 그대로 올립니다 ^^
절대 디자인 감각이 꽝이라 수정 안 한거 아닙니다 ㅜ_ㅜ
테스트 페이지는 저 혼자 집에서 돌리는 실험용 서버라 접속 불가입니다 ^^;
별것 아닌 자료에 너무 긴 말을 남겨서 죄송합니다 ㅡ.ㅡ;;;
모두 날씨가 추운데 건강 조심하시고 항상 행복하세요 ^^
p.s 약간의 수정과 추가 사항이 있습니다. 다운 받아 가신 분들은 다시 받으세요 ^^
원본 스킨에서 어지러운 테이블 그냥 대충 정렬...
원본에서 게시판 제목이 아예 없음을 발견 -_-;; 디자인 없이 그냥 추가...
날짜 출력시 당일인 경우 시간, 당일이 아닌 경우 날짜로 표시 되도록 수정...
날짜의 출력 형식은 m-d ...
여전히 디자인 안함... 죄송...
<style type="text/css">
.com8 {color:0B99FE;font-family:Verdana,Aria,Helvetica,sans-seri;font-size:7pt}
.com7 {color:666666;font-family:돋움;line-height:17px;font-size:9pt}
</style>
<?
///////////////////////////////////////////////////////////////
//최근글에서 이미지를 사용할 경우 생성될 썸네일의 옵션을 설정//
//최근글에서 보여질 제목과 내용의 글자수를 설정 //
///////////////////////////////////////////////////////////////
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 80; //썸네일 가로길이
$img_height = 60; //썸네일 세로길이
$img_quality = 60; //퀼리티 100이하로 설정
$subject_size= 60; //제목 보여질 글자수
$content_size= 210; //내용 보여질 글자수
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumbLatest'; //썸네일 이미지 생성 디렉토리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
///////////////////////////////////////////////////////////////
//최근글에서 이미지를 사용할 경우 생성될 썸네일의 옵션을 설정//
///////////////////////////////////////////////////////////////
?>
<!-- 게시판 이름이 출력되는 부분 -->
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<table border=0 width=100% cellspacing=0 cellpadding=0 align=left>
<tr>
<td colspan=2>
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><?=$board[bo_subject]?></a>
</td>
</tr>
<!-- 게시판 이름이 출력되는 부분 끝 -->
<?
///////////////////////////////////////////////////////////////////////////////////////////
//위에서 설정한 옵션대로 썸네일 이미지를 생성하는 함수 부분 //
//[$g4_path/img/noimage.png] 부분은 이미지가 없을 경우 출력되는 이미지 (개인에 맞게 수정}//
///////////////////////////////////////////////////////////////////////////////////////////
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$g4_path/img/noimage.png' border=1 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=1 align=left style='margin-right:5px; border:1 #222222 solid;'>";
///////////////////////////////////////////////////////////////////////////////////////////
//위에서 설정한 옵션대로 썸네일 이미지를 생성하는 함수 부분 //
///////////////////////////////////////////////////////////////////////////////////////////
?>
<?
///////////////////////////////////////////////////////////
//당일인 경우 시간 당일이 아닌 경우 날짜로 표시하는 함수 //
//<?=$a[$i][wr_date]?> 로 링크 시켜서 사용 //
//뭔가 쓸 때 없는 부분이 있는 것 같은데... 패스~ //
///////////////////////////////////////////////////////////
$datetime = substr($list[$i][wr_datetime],0,10);
$datetime2 = $list[$i][wr_datetime];
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($row['bo_new'] * 3600))) $comment_new = "new";
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$a[$i] = array(
"wr_date"=>$datetime2,
);
///////////////////////////////////////////////////////////
//당일인 경우 시간 당일이 아닌 경우 날짜로 표시하는 함수 //
///////////////////////////////////////////////////////////
?>
<?
/////////////////////////////////////////////////////////////////////
//제목과 링크 코멘트 내용 부분을 어떻게 출력할 것인지 결정하는 함수//
//본인에게 맞게 수정하여 사용하세요 ^^ (수정 안해도 지장은 없음) //
/////////////////////////////////////////////////////////////////////
$rw_subject = cut_str(stripslashes($list[$i][subject]),$subject_size,'..');
$a_link="<a href='{$list[$i][href]}'>$rw_subject</a>";
$a_img="<a href='{$list[$i][href]}'>$img</a>";
$a_comment="<a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i]['comment_cnt']}</span></a>";
$rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
$rw_content = strip_tags($rw_content);
/////////////////////////////////////////////////////////////////////
//제목과 링크 코멘트 내용 부분을 어떻게 출력할 것인지 결정하는 함수//
/////////////////////////////////////////////////////////////////////
?>
<!-- 최신글 출력 부분 본인에게 맞게 알맞게 꾸며서 쓰세요 ^^ -->
<tr>
<td width="<?=$img_width?>" height="<?=$img_height?>" rowspan="2">
<?=$a_img?>
</td>
<td width="100%" height="8" align="left">
<span class="com8"><?=$a[$i][wr_date]?></span> <span class=small><font color=#2B3E8E>[<?=$list[$i][ca_name]?>]</font></span> <?=$a_link?> <?=$a_comment?>
</td>
</tr>
<tr>
<td width="100%" height="<?=$img_height -8?>" align=left valign=top>
<span class="com7"><?=$rw_content?></span>
</td>
</tr>
<!-- 최신 글 출력 부분 끝 -->
<? } ?>
</table>
</td>
</tr>
</table>
하나 만들어 봤습니다. (링크 참조)
썸네일 생성하는 코드는 기본 스킨중에 스킨게시판용에서 쓰인 코드를
뜯어와서 붙였습니다. 첫 번째 이미지만 썸네일로 생성합니다.
썸네일 가로길이, 세로 길이, 퀄리티, 글자수는 자신에게 맞게 설정하시구요
중간에 썸네일 이미지 생성디렉토리도 자신에게 맞게 고쳐 쓰시기 바랍니다. ^^
아참 이미지가 없을 경우를 대비해서 그누보드 기본 img 폴더에
noimage 파일 하나 넣어 두시길 바랍니다.
저는 png 이미지만 쓰는지라 코드엔 png로 들어가 있네요. 쓰시는걸로 수정 ^^
그리고 이미지가 표시되는 왼쪽 테이블 td 부분은
썸네일의 가로와 세로 길이로 자동 설정되게 했습니다.
아래는 코드 전문입니다.
지저분 + 짜집기 한거란게 확 티가 나네요 ^^;;
모양은 이현용님 스킨에서 일부러 다듬지 않았습니다.
제일 아래 테이블 부분만 조금씩 손 보면서 자신에게 맞게 다듬으시라고
테이블 모양은 원본 그대로 올립니다 ^^
절대 디자인 감각이 꽝이라 수정 안 한거 아닙니다 ㅜ_ㅜ
테스트 페이지는 저 혼자 집에서 돌리는 실험용 서버라 접속 불가입니다 ^^;
별것 아닌 자료에 너무 긴 말을 남겨서 죄송합니다 ㅡ.ㅡ;;;
모두 날씨가 추운데 건강 조심하시고 항상 행복하세요 ^^
p.s 약간의 수정과 추가 사항이 있습니다. 다운 받아 가신 분들은 다시 받으세요 ^^
원본 스킨에서 어지러운 테이블 그냥 대충 정렬...
원본에서 게시판 제목이 아예 없음을 발견 -_-;; 디자인 없이 그냥 추가...
날짜 출력시 당일인 경우 시간, 당일이 아닌 경우 날짜로 표시 되도록 수정...
날짜의 출력 형식은 m-d ...
여전히 디자인 안함... 죄송...
<style type="text/css">
.com8 {color:0B99FE;font-family:Verdana,Aria,Helvetica,sans-seri;font-size:7pt}
.com7 {color:666666;font-family:돋움;line-height:17px;font-size:9pt}
</style>
<?
///////////////////////////////////////////////////////////////
//최근글에서 이미지를 사용할 경우 생성될 썸네일의 옵션을 설정//
//최근글에서 보여질 제목과 내용의 글자수를 설정 //
///////////////////////////////////////////////////////////////
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$img_width = 80; //썸네일 가로길이
$img_height = 60; //썸네일 세로길이
$img_quality = 60; //퀼리티 100이하로 설정
$subject_size= 60; //제목 보여질 글자수
$content_size= 210; //내용 보여질 글자수
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumbLatest'; //썸네일 이미지 생성 디렉토리
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
///////////////////////////////////////////////////////////////
//최근글에서 이미지를 사용할 경우 생성될 썸네일의 옵션을 설정//
///////////////////////////////////////////////////////////////
?>
<!-- 게시판 이름이 출력되는 부분 -->
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<table border=0 width=100% cellspacing=0 cellpadding=0 align=left>
<tr>
<td colspan=2>
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><?=$board[bo_subject]?></a>
</td>
</tr>
<!-- 게시판 이름이 출력되는 부분 끝 -->
<?
///////////////////////////////////////////////////////////////////////////////////////////
//위에서 설정한 옵션대로 썸네일 이미지를 생성하는 함수 부분 //
//[$g4_path/img/noimage.png] 부분은 이미지가 없을 경우 출력되는 이미지 (개인에 맞게 수정}//
///////////////////////////////////////////////////////////////////////////////////////////
for ($i=0; $i<count($list); $i++)
{
$img = "<img src='$g4_path/img/noimage.png' border=1 width='$img_width' height='$img_height' title='이미지 없음' align=left style='margin-right:5px; border:1 #222222 solid;'>";
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
// 업로드된 파일이 이미지라면
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
break;
$rate = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
if (file_exists($thumb))
$img = "<img src='$thumb' border=1 align=left style='margin-right:5px; border:1 #222222 solid;'>";
///////////////////////////////////////////////////////////////////////////////////////////
//위에서 설정한 옵션대로 썸네일 이미지를 생성하는 함수 부분 //
///////////////////////////////////////////////////////////////////////////////////////////
?>
<?
///////////////////////////////////////////////////////////
//당일인 경우 시간 당일이 아닌 경우 날짜로 표시하는 함수 //
//<?=$a[$i][wr_date]?> 로 링크 시켜서 사용 //
//뭔가 쓸 때 없는 부분이 있는 것 같은데... 패스~ //
///////////////////////////////////////////////////////////
$datetime = substr($list[$i][wr_datetime],0,10);
$datetime2 = $list[$i][wr_datetime];
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", $g4['server_time'] - ($row['bo_new'] * 3600))) $comment_new = "new";
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$a[$i] = array(
"wr_date"=>$datetime2,
);
///////////////////////////////////////////////////////////
//당일인 경우 시간 당일이 아닌 경우 날짜로 표시하는 함수 //
///////////////////////////////////////////////////////////
?>
<?
/////////////////////////////////////////////////////////////////////
//제목과 링크 코멘트 내용 부분을 어떻게 출력할 것인지 결정하는 함수//
//본인에게 맞게 수정하여 사용하세요 ^^ (수정 안해도 지장은 없음) //
/////////////////////////////////////////////////////////////////////
$rw_subject = cut_str(stripslashes($list[$i][subject]),$subject_size,'..');
$a_link="<a href='{$list[$i][href]}'>$rw_subject</a>";
$a_img="<a href='{$list[$i][href]}'>$img</a>";
$a_comment="<a href=\"{$list[$i][comment_href]}\"><span class='commentFont'>{$list[$i]['comment_cnt']}</span></a>";
$rw_content = cut_str(stripslashes($list[$i][wr_content]),$content_size,' ..more');
$rw_content = strip_tags($rw_content);
/////////////////////////////////////////////////////////////////////
//제목과 링크 코멘트 내용 부분을 어떻게 출력할 것인지 결정하는 함수//
/////////////////////////////////////////////////////////////////////
?>
<!-- 최신글 출력 부분 본인에게 맞게 알맞게 꾸며서 쓰세요 ^^ -->
<tr>
<td width="<?=$img_width?>" height="<?=$img_height?>" rowspan="2">
<?=$a_img?>
</td>
<td width="100%" height="8" align="left">
<span class="com8"><?=$a[$i][wr_date]?></span> <span class=small><font color=#2B3E8E>[<?=$list[$i][ca_name]?>]</font></span> <?=$a_link?> <?=$a_comment?>
</td>
</tr>
<tr>
<td width="100%" height="<?=$img_height -8?>" align=left valign=top>
<span class="com7"><?=$rw_content?></span>
</td>
</tr>
<!-- 최신 글 출력 부분 끝 -->
<? } ?>
</table>
</td>
</tr>
</table>
추천
0
0
댓글 전체

여기에서 배우면서 처음으로 올려보는거라 솔직히 좀 떨리네요 ㅡ.ㅡ;;
날짜를 다른 td 셀로 옮기는것도 어떠신지.. ^^
특히 스크린샷에서 첫번째 최근글은 날짜가 다음줄로 넘어가서 아쉽네요^^;;
특히 스크린샷에서 첫번째 최근글은 날짜가 다음줄로 넘어가서 아쉽네요^^;;

최종적으로 보여주는 코드가 테이블만 간단히 손보면 되는 워낙에 간단한 것이라 본인의 입맛에 맞게 고쳐쓰시라구 원본에서 일부러 손을 안 보고 올렸습니다 ^^; 저도 좀 더 미려하게 다듬고 있는데 저에게 최적화 된 것이라 다른 분들께는 맞을지 모르겟네요 ^^;
우옷.. 좋은 스킨 공개 감사 드리구요.. 기회되면 한번 써보도록 하겠습니다! ^^
감사합니다.
잘쓰겠습니다. 감사합니다~
잘쓰겠습니다~
감사합니다.
늘 감사드립니다.
감사
감사합니다.
좋은 정보 감사합니다
제가 찾던 스킨이네요...감솨

noimage 경로 에러는 아래와 같이 하면 해결됩니다.
} else {
$view_img=$latest_skin_path."/img/noimage.gif' width='75' height='75' border='0' style='padding:4px; border:#cdcdcd solid 1px;'></a>";
위의 내용을 아래와 같이 수정하세요.
} else {
$view_img="<a href='{$list[$i][href]}'><img src=".$latest_skin_path."/img/noimage.gif width='$img_w' height='$img_h' border='0' alt='no imgage' title='no imgae'></a>";
} else {
$view_img=$latest_skin_path."/img/noimage.gif' width='75' height='75' border='0' style='padding:4px; border:#cdcdcd solid 1px;'></a>";
위의 내용을 아래와 같이 수정하세요.
} else {
$view_img="<a href='{$list[$i][href]}'><img src=".$latest_skin_path."/img/noimage.gif width='$img_w' height='$img_h' border='0' alt='no imgage' title='no imgae'></a>";

고맙습니다.

고생하셨습니다.

감사합니다.
