화니

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

그누보드에서 파일을 무조건 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>";

}
|

댓글 2개

훌륭함돠~...플래쉬파일을 쓰시는분들께 좋은팁인것같네요^^
화니님의 팁택은 액션이죠 !!
수고 하셨습니다.

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고