첨부화일 본문에 나타내기 정보
첨부화일 본문에 나타내기
본문
1. blog.lib.php 의 아래 부분을 찾아서 바꿉니다..
바꾸기전 :
/*
-----------------------------------------------------------
게시글에 첨부된 파일을 얻는다. (배열로 반환)
-----------------------------------------------------------
*/
function get_blog_file($post_id)
{
global $g4, $gb4, $qstr, $current;
$file = array();
$file["count"] = 0;
$sql = " select * from {$gb4['file_table']} where blog_id = '{$current['id']}' and post_id = '{$post_id}' order by file_num ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = $row['file_num'];
$file[$no]['href'] = "./download.php?mb_id={$current['mb_id']}&post_id={$post_id}&file_num={$row['file_num']}";
$file[$no]['download'] = $row['download_count'];
$file[$no]['path'] = "{$g4[path]}/data/blog/file/{$current['mb_id']}";
$file[$no]['size'] = get_filesize($row['file_size']);
$file[$no]['datetime'] = $row['datetime'];
$file[$no]['save_name'] = $row['save_name'];
$file[$no]['real_name'] = $row['real_name'];
$file['count']++;
}
return $file;
}
바꾼후 :
/*
-----------------------------------------------------------
게시글에 첨부된 파일을 얻는다. (배열로 반환)
-----------------------------------------------------------
*/
function get_blog_file($post_id)
{
global $g4, $gb4, $qstr, $current;
$file = array();
$file["count"] = 0;
$sql = " select * from {$gb4['file_table']} where blog_id = '{$current['id']}' and post_id = '{$post_id}' order by file_num ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = $row['file_num'];
$file[$no]['href'] = "./download.php?mb_id={$current['mb_id']}&post_id={$post_id}&file_num={$row['file_num']}";
$file[$no]['download'] = $row['download_count'];
$file[$no]['path'] = "{$g4[path]}/data/blog/file/{$current['mb_id']}";
$file[$no]['size'] = get_filesize($row['file_size']);
$file[$no]['datetime'] = $row['datetime'];
$file[$no]['save_name'] = $row['save_name'];
$file[$no]['real_name'] = $row['real_name'];
$file[$no]['imgsize'] = @getimagesize("{$file[$no][path]}/$row[save_name]"); //by 천상재회()
$img_width = $file[$no][imgsize][0]; //by 천상재회()
$img_height = $file[$no][imgsize][1]; //by 천상재회()
$file[$no]['view'] = view_blog_file_link($row['save_name'], $img_width, $img_height); //by 천상재회()
$file['count']++;
}
return $file;
}
// 그블로그의 첨부화일을 보이게 하는 링크 (이미지, 플래쉬, 동영상)
// by 천상재회 ()
function view_blog_file_link($file, $width, $height){
global $config, $g4, $gb4, $qstr, $current;
static $ids;
if (!$file) return;
$ids++;
// 파일의 폭이 게시판설정의 이미지폭 보다 크다면 게시판설정 폭으로 맞추고 비율에 따라 높이를 계산
if ($width > $upload_image_width && $upload_image_width)
{
$rate = $upload_image_width / $width;
$width = $upload_image_width;
$height = (int)($height * $rate);
}
if (preg_match("/\.($config[cf_image_extension])$/i", $file))
// 이미지에 속성을 주지 않는 이유는 이미지 클릭시 원본 이미지를 보여주기 위한것임
// 게시판설정 이미지보다 크다면 스킨의 자바스크립트에서 이미지를 줄여준다
return "<img src='$g4[path]/data/blog/file/{$current[mb_id]}/".urlencode($file)."' name='target_resize_image[]' onclick='image_window(this);' style='cursor:pointer;'>";
else if (preg_match("/\.($config[cf_flash_extension])$/i", $file))
//return "<embed src='$g4[path]/data/file/$board[bo_table]/$file' $attr></embed>";
return "<script-x>doc_write(flash_movie('$g4[path]/data/blog/file/{$current[mb_id]}/$file', '_g4_{$ids}', '$width', '$height', 'transparent'));</script-x>";
else if (preg_match("/\.($config[cf_movie_extension])$/i", $file))
//return "<embed src='$g4[path]/data/file/$board[bo_table]/$file' $attr></embed>";
return "<script-x>doc_write(obj_movie('$g4[path]/data/blog/file/{$current[mb_id]}/$file', '_g4_{$ids}', '$width', '$height'));</script-x>";
}
2. skin/blog/basic/index.skin.php 의 아래 부분을 변경한다.
바꾸기전 :
<!-- 본문 -->
<div class="article">
<?=nl2br($post[$i]['content'])?>
</div>
바꾸기후 :
<!-- 본문 -->
<div class="article">
<?for($j=0; $j<count($post[$i]['file']); $j++) {
if ($post[$i]['file'][$j]['view'])
echo $post[$i]['file'][$j]['view'] . "<p>";
} ?>
<?=nl2br($post[$i]['content'])?>
</div>
바꾸기전 :
/*
-----------------------------------------------------------
게시글에 첨부된 파일을 얻는다. (배열로 반환)
-----------------------------------------------------------
*/
function get_blog_file($post_id)
{
global $g4, $gb4, $qstr, $current;
$file = array();
$file["count"] = 0;
$sql = " select * from {$gb4['file_table']} where blog_id = '{$current['id']}' and post_id = '{$post_id}' order by file_num ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = $row['file_num'];
$file[$no]['href'] = "./download.php?mb_id={$current['mb_id']}&post_id={$post_id}&file_num={$row['file_num']}";
$file[$no]['download'] = $row['download_count'];
$file[$no]['path'] = "{$g4[path]}/data/blog/file/{$current['mb_id']}";
$file[$no]['size'] = get_filesize($row['file_size']);
$file[$no]['datetime'] = $row['datetime'];
$file[$no]['save_name'] = $row['save_name'];
$file[$no]['real_name'] = $row['real_name'];
$file['count']++;
}
return $file;
}
바꾼후 :
/*
-----------------------------------------------------------
게시글에 첨부된 파일을 얻는다. (배열로 반환)
-----------------------------------------------------------
*/
function get_blog_file($post_id)
{
global $g4, $gb4, $qstr, $current;
$file = array();
$file["count"] = 0;
$sql = " select * from {$gb4['file_table']} where blog_id = '{$current['id']}' and post_id = '{$post_id}' order by file_num ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = $row['file_num'];
$file[$no]['href'] = "./download.php?mb_id={$current['mb_id']}&post_id={$post_id}&file_num={$row['file_num']}";
$file[$no]['download'] = $row['download_count'];
$file[$no]['path'] = "{$g4[path]}/data/blog/file/{$current['mb_id']}";
$file[$no]['size'] = get_filesize($row['file_size']);
$file[$no]['datetime'] = $row['datetime'];
$file[$no]['save_name'] = $row['save_name'];
$file[$no]['real_name'] = $row['real_name'];
$file[$no]['imgsize'] = @getimagesize("{$file[$no][path]}/$row[save_name]"); //by 천상재회()
$img_width = $file[$no][imgsize][0]; //by 천상재회()
$img_height = $file[$no][imgsize][1]; //by 천상재회()
$file[$no]['view'] = view_blog_file_link($row['save_name'], $img_width, $img_height); //by 천상재회()
$file['count']++;
}
return $file;
}
// 그블로그의 첨부화일을 보이게 하는 링크 (이미지, 플래쉬, 동영상)
// by 천상재회 ()
function view_blog_file_link($file, $width, $height){
global $config, $g4, $gb4, $qstr, $current;
static $ids;
if (!$file) return;
$ids++;
// 파일의 폭이 게시판설정의 이미지폭 보다 크다면 게시판설정 폭으로 맞추고 비율에 따라 높이를 계산
if ($width > $upload_image_width && $upload_image_width)
{
$rate = $upload_image_width / $width;
$width = $upload_image_width;
$height = (int)($height * $rate);
}
if (preg_match("/\.($config[cf_image_extension])$/i", $file))
// 이미지에 속성을 주지 않는 이유는 이미지 클릭시 원본 이미지를 보여주기 위한것임
// 게시판설정 이미지보다 크다면 스킨의 자바스크립트에서 이미지를 줄여준다
return "<img src='$g4[path]/data/blog/file/{$current[mb_id]}/".urlencode($file)."' name='target_resize_image[]' onclick='image_window(this);' style='cursor:pointer;'>";
else if (preg_match("/\.($config[cf_flash_extension])$/i", $file))
//return "<embed src='$g4[path]/data/file/$board[bo_table]/$file' $attr></embed>";
return "<script-x>doc_write(flash_movie('$g4[path]/data/blog/file/{$current[mb_id]}/$file', '_g4_{$ids}', '$width', '$height', 'transparent'));</script-x>";
else if (preg_match("/\.($config[cf_movie_extension])$/i", $file))
//return "<embed src='$g4[path]/data/file/$board[bo_table]/$file' $attr></embed>";
return "<script-x>doc_write(obj_movie('$g4[path]/data/blog/file/{$current[mb_id]}/$file', '_g4_{$ids}', '$width', '$height'));</script-x>";
}
2. skin/blog/basic/index.skin.php 의 아래 부분을 변경한다.
바꾸기전 :
<!-- 본문 -->
<div class="article">
<?=nl2br($post[$i]['content'])?>
</div>
바꾸기후 :
<!-- 본문 -->
<div class="article">
<?for($j=0; $j<count($post[$i]['file']); $j++) {
if ($post[$i]['file'][$j]['view'])
echo $post[$i]['file'][$j]['view'] . "<p>";
} ?>
<?=nl2br($post[$i]['content'])?>
</div>
댓글 전체
아따 좋습니다요^^
기본으로 들어가야 하는거 아니감유..
기본으로 들어가야 하는거 아니감유..
에러가 나네요. 음.