플래시 파일일때 페이지 오류 수정 > 그누3 팁자료실

그누3 팁자료실

플래시 파일일때 페이지 오류 수정 정보

그누호환 플래시 파일일때 페이지 오류 수정

본문

그누보드에서 파일을 무조건 getimagesize 함수로 크기 체크를 합니다.
gd버전마다 다르겠지만 저의 경우엔 페이지를 찾을 수 없다는 오류메세지가 나와서 수정했습니다.

lib/gnuboard.lib.php 파일입니다.
=============수정전===========
// 파일을 보이게 하는 링크 (이미지, 플래쉬, 동영상)
function view_file_link($file)
{
    global $cfg, $board;

    if (!$file) return;

    $size = @getimagesize("{$cfg[filepath]}/data/file/$board[bo_table]/$file");
    $source_width  = $size[0];
    $source_height = $size[1];

    if ($board[bo_table_width] <= 100) {
        if ($size[0] > $cfg[large_image_size]) {
            $rate = $size[1] / $size[0];
            $size[0] = $cfg[large_image_size];
            $size[1] = (int)($size[0] * $rate);
        }
    } else {
        if ($size[0] > $board[bo_table_width]) {
            $rate = $size[1] / $size[0];
            $size[0] = $board[bo_table_width];
            $size[1] = (int)($size[0] * $rate);
        }
    }

    $width  = $size[0];
    $height = $size[1];

    if (preg_match($cfg[image_extension], $file))
        // 3.36
        return "<a href=\"javascript:;\" onclick=\"image_window('./data/file/$board[bo_table]/$file', $source_width, $source_height);\"><img src='./data/file/$board[bo_table]/$file' width='$width' height='$height' border=0></a><p>";
    else if (preg_match($cfg[flash_extension], $file))
        return "<embed src='./data/file/$board[bo_table]/$file' width='$width' height='$height'></embed><p>";
    else if (preg_match($cfg[movie_extension], $file))
        return "<embed src='./data/file/$board[bo_table]/$file' autostart='false' ShowStatusBar=1></embed><p>";


}
==========수정후=============
// 파일을 보이게 하는 링크 (이미지, 플래쉬, 동영상)
function view_file_link($file)
{
    global $cfg, $board;

    if (!$file) return;

$width=320;
$height=240;

    if (preg_match($cfg[image_extension], $file))
{
    $size = @getimagesize("{$cfg[filepath]}/data/file/$board[bo_table]/$file");
$source_width  = $size[0];
$source_height = $size[1];

if ($board[bo_table_width] <= 100) {
if ($size[0] > $cfg[large_image_size]) {
$rate = $size[1] / $size[0];
$size[0] = $cfg[large_image_size];
$size[1] = (int)($size[0] * $rate);
}
} else {
if ($size[0] > $board[bo_table_width]) {
$rate = $size[1] / $size[0];
$size[0] = $board[bo_table_width];
$size[1] = (int)($size[0] * $rate);
}
}

$width  = $size[0];
$height = $size[1];
        // 3.36
        return "<a href=\"javascript:;\" onclick=\"image_window('./data/file/$board[bo_table]/$file', $source_width, $source_height);\"><img src='./data/file/$board[bo_table]/$file' width='$width' height='$height' border=0></a><p>";
    else if (preg_match($cfg[flash_extension], $file))
        return "<embed src='./data/file/$board[bo_table]/$file' width='$width' height='$height'></embed><p>";
    else if (preg_match($cfg[movie_extension], $file))
        return "<embed src='./data/file/$board[bo_table]/$file' autostart='false' ShowStatusBar=1></embed><p>";

}
추천
0
  • 복사

댓글 전체

© SIRSOFT
현재 페이지 제일 처음으로