태그 인덱스에 첨부파일 썸네일... 정보
태그 인덱스에 첨부파일 썸네일...관련링크
http://iallu.com/gblog.index.php
274회 연결
본문
------------------------------------------------------------
<?
$g4_path = ".";
include_once("$g4_path/_common.php");
$g4[title] = "인기태그";
include_once("$g4[path]/lib/blog.lib.php");
include_once("$g4[path]/head.php");
include_once("$g4[path]/gblog.config.php");
?>
$g4_path = ".";
include_once("$g4_path/_common.php");
$g4[title] = "인기태그";
include_once("$g4[path]/lib/blog.lib.php");
include_once("$g4[path]/head.php");
include_once("$g4[path]/gblog.config.php");
?>
<style type="text/css">
/* tab cloud */
#tag_cloud {padding:10px 15px; color:#7C8A8D; text-align:justify; table-layout:fixed; line-height:260%;letter-spacing:-1px; word-break:break-all;}
#tag_cloud a:link {color:#7C8A8D}
#tag_cloud a:visited {color:#7C8A8D}
#tag_cloud a:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud a.tag2 {color:#00B4B5; font-weight:bold; font-size:15px;}
#tag_cloud a.tag2:link {color:#00B4B5;}
#tag_cloud a.tag2:visited {color:#00B4B5;}
#tag_cloud a.tag2:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud a.tag3 {color:#3D7B66; font-weight:bold; font-size:18px;}
#tag_cloud a.tag3:link {color:#3D7B66;}
#tag_cloud a.tag3:visited {color:#3D7B66;}
#tag_cloud a.tag3:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud a.tag4 {color:#FFF; font-weight:bold; font-size:20px;}
#tag_cloud a.tag4:link {background-color:#12D763; color:#FFF; text-decoration:none;}
#tag_cloud a.tag4:visited {background-color:#12D763; color:#FFF; text-decoration:none;}
#tag_cloud a.tag4:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud .tagspace {padding:0 6px 0 4px; color:#CCC;}
</style>
/* tab cloud */
#tag_cloud {padding:10px 15px; color:#7C8A8D; text-align:justify; table-layout:fixed; line-height:260%;letter-spacing:-1px; word-break:break-all;}
#tag_cloud a:link {color:#7C8A8D}
#tag_cloud a:visited {color:#7C8A8D}
#tag_cloud a:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud a.tag2 {color:#00B4B5; font-weight:bold; font-size:15px;}
#tag_cloud a.tag2:link {color:#00B4B5;}
#tag_cloud a.tag2:visited {color:#00B4B5;}
#tag_cloud a.tag2:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud a.tag3 {color:#3D7B66; font-weight:bold; font-size:18px;}
#tag_cloud a.tag3:link {color:#3D7B66;}
#tag_cloud a.tag3:visited {color:#3D7B66;}
#tag_cloud a.tag3:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud a.tag4 {color:#FFF; font-weight:bold; font-size:20px;}
#tag_cloud a.tag4:link {background-color:#12D763; color:#FFF; text-decoration:none;}
#tag_cloud a.tag4:visited {background-color:#12D763; color:#FFF; text-decoration:none;}
#tag_cloud a.tag4:hover {background-color:#1E4F55; color:#FFFF00; text-decoration:none; selector-dummy:expression(this.hideFocus=true)}
#tag_cloud .tagspace {padding:0 6px 0 4px; color:#CCC;}
</style>
<table style="TABLE-LAYOUT:fixed;" width="97%" border="0" cellpadding="0" cellspacing="0" align="center">
<? if (!$tag) { ?>
<tr>
<td>
<div id="tag_cloud">
<?
// 마지막 업데이트 된 태그
$date = "30"; //기간
$lastdate = date("Y-m-d H:i:s", $g4['server_time'] - ($date * 86400));
// 인기태그 출력
$sql = " select * from $gb4[tag_table] where lastdate > '$lastdate' order by tag asc limit 60 ";
$result = sql_query($sql);
for($i=0; $row = sql_fetch_array($result); $i++) {
$sql = " select * from $gb4[tag_table] where lastdate > '$lastdate' order by tag asc limit 60 ";
$result = sql_query($sql);
for($i=0; $row = sql_fetch_array($result); $i++) {
// 카운트 별 클래스 변경
if ($row[tag_count] >= '10') {
$class_tag = "tag4";
}
else if ($row[tag_count] >= '5') {
$class_tag = "tag3";
}
else if ($row[tag_count] >= '3') {
$class_tag = "tag2";
} else {
$class_tag = "";
}
if ($row[tag_count] >= '10') {
$class_tag = "tag4";
}
else if ($row[tag_count] >= '5') {
$class_tag = "tag3";
}
else if ($row[tag_count] >= '3') {
$class_tag = "tag2";
} else {
$class_tag = "";
}
$space = "<span class=tagspace>|</span>";
echo "<a href='?tag_id={$row[id]}&tag=view' class='{$class_tag}'>" . $row[tag] . "</a>{$space}";
}
?></div></td>
</tr>
<? } ?>
<?
if ($tag == 'view') {
}
?></div></td>
</tr>
<? } ?>
<?
if ($tag == 'view') {
// 페이지
$tag_sql = " select count(*) as cnt from $gb4[taglog_table] where tag_id = '$tag_id' ";
$tag_row = sql_fetch($tag_sql);
$tag_sql = " select count(*) as cnt from $gb4[taglog_table] where tag_id = '$tag_id' ";
$tag_row = sql_fetch($tag_sql);
$total_count = $tag_row[cnt];
// $tag_rows = $config[cf_page_rows]; //관리자 설정된 페이지
$tag_rows = "10"; // 수동 페이지
$total_page = ceil($total_count / $tag_rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $tag_rows; // 시작 열을 구함
$tag_rows = "10"; // 수동 페이지
$total_page = ceil($total_count / $tag_rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $tag_rows; // 시작 열을 구함
// TAGLOG
$sql2 = " select * from $gb4[taglog_table] where tag_id = '$tag_id' order by regdate desc limit $from_record, $tag_rows ";
$result2 = sql_query($sql2);
$sql2 = " select * from $gb4[taglog_table] where tag_id = '$tag_id' order by regdate desc limit $from_record, $tag_rows ";
$result2 = sql_query($sql2);
// PAGE LIST
$pagelist = get_paging($config[cf_write_pages], $page, $total_page, "?tag_id={$tag_id}&tag=view&page=");
$pagelist = get_paging($config[cf_write_pages], $page, $total_page, "?tag_id={$tag_id}&tag=view&page=");
for($j=0;$row2 = sql_fetch_array($result2);$j++) {
// POST
$sql3 = " select * from $gb4[post_table] where blog_id = '$row2[blog_id]' and id = '$row2[post_id]' ";
$row3 = sql_fetch($sql3);
// BLOG
$sql4 = " select * from $gb4[blog_table] where id = '$row3[blog_id]' ";
$row4 = sql_fetch($sql4);
$sql3 = " select * from $gb4[post_table] where blog_id = '$row2[blog_id]' and id = '$row2[post_id]' ";
$row3 = sql_fetch($sql3);
// BLOG
$sql4 = " select * from $gb4[blog_table] where id = '$row3[blog_id]' ";
$row4 = sql_fetch($sql4);
$date = date("Y-m-d H:i", strtotime($row3[post_date]));
$content = $row3[content];
$content = strip_tags($content);
$content = cut_str($content, 300);
$content = strip_tags($content);
$content = cut_str($content, 300);
// 해당 포스트 전체 태그 출력
$sql5 = "select
t.id, t.tag
from
{$gb4['taglog_table']} l left join {$gb4['tag_table']} t on l.tag_id=t.id
where
blog_id='{$row4['id']}'
and post_id='{$row3['id']}'";
$tag_qry = sql_query($sql5);
$sql5 = "select
t.id, t.tag
from
{$gb4['taglog_table']} l left join {$gb4['tag_table']} t on l.tag_id=t.id
where
blog_id='{$row4['id']}'
and post_id='{$row3['id']}'";
$tag_qry = sql_query($sql5);
// 태그에는 링크를 자동으로 붙인다.
$tag_list = '';
while($tag_res = sql_fetch_array($tag_qry))
$tag_list .= "<a href=\"".get_blog_url($row4[mb_id]).get_tag_url($tag_res['tag'])."\">".trim($tag_res['tag'])."</a>, ";
$tag = substr($tag_list, 0, strlen($tag_list)-2);
$tag_list = '';
while($tag_res = sql_fetch_array($tag_qry))
$tag_list .= "<a href=\"".get_blog_url($row4[mb_id]).get_tag_url($tag_res['tag'])."\">".trim($tag_res['tag'])."</a>, ";
$tag = substr($tag_list, 0, strlen($tag_list)-2);
echo "<tr><td height=1 bgcolor=#d2d2d2></td></tr>";
echo "<tr><td height=5></td></tr>";
echo "<tr><td height='25'>";
echo "<a href='".get_post_url($row3[id],$row4[mb_id])."'><span style='color:#203682;'>$row3[title]</span></a> <span style='color:#989898'>|</span> <span style='color:#999999;'>{$row4[blog_name]}</span> <span class='eng' style='padding:0 3px 0 10px;'>{$date}</span></td></tr>";
echo "<tr><td height=5></td></tr>";
?>
<tr><td style='word-break:break-all;'>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<?
/*
-------------------------------------------------
썸네일 코드 추가
-------------------------------------------------
*/
$sql6 = " select * from {$gb4['file_table']} where post_id = '$row3[id]' ";
$row6 = sql_fetch($sql6);
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<?
/*
-------------------------------------------------
썸네일 코드 추가
-------------------------------------------------
*/
$sql6 = " select * from {$gb4['file_table']} where post_id = '$row3[id]' ";
$row6 = sql_fetch($sql6);
//섬네일 관련 설정
$thumb1_width=200;//섬네일 최대폭
$thumb1_height=200;//섬네일 최대높이
$image = $row6[save_name]; // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
if(!is_file('$g4[path]/data/blog/file/$row4[mb_id]/thumb1_$image')){
include_once "$g4[path]/thumbEngine/dq_thumb_engine2.php";
$thumbsource="$g4[path]/data/blog/file/$row4[mb_id]/" . $image;
$thumbimg="$g4[path]/data/blog/file/$row4[mb_id]/thumb1_" . $image;
make_thumb($thumb1_width,$thumb1_height,$thumbsource,$thumbimg);
@chmod($thumbimg, 0606);
}
}
$thumb1_width=200;//섬네일 최대폭
$thumb1_height=200;//섬네일 최대높이
$image = $row6[save_name]; // 첫번째 파일이 이미지라면
if (preg_match("/\.(gif|jpg|png)$/i", $image)) {
if(!is_file('$g4[path]/data/blog/file/$row4[mb_id]/thumb1_$image')){
include_once "$g4[path]/thumbEngine/dq_thumb_engine2.php";
$thumbsource="$g4[path]/data/blog/file/$row4[mb_id]/" . $image;
$thumbimg="$g4[path]/data/blog/file/$row4[mb_id]/thumb1_" . $image;
make_thumb($thumb1_width,$thumb1_height,$thumbsource,$thumbimg);
@chmod($thumbimg, 0606);
}
}
if ($image) {
echo "<td width='100' height='100' style='padding:0 10 0 0px;'><a href='".get_post_url($row3[id],$row4[mb_id])."'><img src='{$thumbimg}' align='absmiddle' border='0'></a></td>";
} else {
echo "";
}
echo "<td width='100' height='100' style='padding:0 10 0 0px;'><a href='".get_post_url($row3[id],$row4[mb_id])."'><img src='{$thumbimg}' align='absmiddle' border='0'></a></td>";
} else {
echo "";
}
/*
-------------------------------------------------
썸네일 코드 닫기
-------------------------------------------------
*/
?>
<td valign=top>
<a href="<?=get_post_url($row3[id],$row4[mb_id]);?>"><?=$content?></a><p>
<img src="<?=$g4[path]?>/blog/img/tag_icon.gif" align="absmiddle"> <?=$tag?></td>
</tr>
</table></td></tr>
<tr><td height=5></td></tr>
-------------------------------------------------
썸네일 코드 닫기
-------------------------------------------------
*/
?>
<td valign=top>
<a href="<?=get_post_url($row3[id],$row4[mb_id]);?>"><?=$content?></a><p>
<img src="<?=$g4[path]?>/blog/img/tag_icon.gif" align="absmiddle"> <?=$tag?></td>
</tr>
</table></td></tr>
<tr><td height=5></td></tr>
<?
} //for 닫기
?>
<tr><td height=1 bgcolor=#d2d2d2></td></tr>
<? } ?>
</table>
<p>
<center><?=$pagelist?></center>
</table>
<p>
<center><?=$pagelist?></center>
<?
include_once("$g4[path]/tail.php");
?>
include_once("$g4[path]/tail.php");
?>
------------------------------------------------------------
모르솔라준회원님이 공개하신 태그인덱스(tag.php)의 체크에디터로 업로드된 이미지의 썸네일처리부분을 첨부파일의 썸네일로 수정했습니다...
GD 2.0 이상만 썸네일이 안정적으로 작동할겁니다...
사용서버나 호스팅서버의 GD버젼에 따라 작동하지 않을수도 있습니다...
다른부분은 대동소이하고 썸네일이 체크에디터 업로드파일의 썸네일이냐 첨부파일업로드의 썸네일이냐의 차이입니다...
썸네일 크기 지정은...
$thumb1_width=200;//섬네일 최대폭
$thumb1_height=200;//섬네일 최대높이
$thumb1_height=200;//섬네일 최대높이
역시나 헤드풋테일과 이미지는 자신의 상황에 맞게 수정사용 하시기 바랍니다...
추천
0
0
댓글 전체
dq_thumb_engine2.php를 빼먹었네요...
이 파일은..
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=42139
요기서 다운 받으신후 경로대로 업로드...
이 파일은..
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=42139
요기서 다운 받으신후 경로대로 업로드...
이미지가 안나오네요..
thumb1을 만들어줘야 하나요??
thumb1을 만들어줘야 하나요??
http://www.iallu.com/blog/tb.php/offspin/19/58aa05ba6ac1536884d7da1ee63a78b1
7쟁이님은 해결하신걸로 알고 있고 다른분들을 위해 dq_thumb_engine2.php의 다른 링크걸어 둡니다...
7쟁이님은 해결하신걸로 알고 있고 다른분들을 위해 dq_thumb_engine2.php의 다른 링크걸어 둡니다...

와 필요한 팁이었어요. 감사합니다. ^_^
체크에디터로 업로드된 이미지의 썸네일 처리 부분을 첨부파일의 썸네일로 수정