화니

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

· 2005-01-13 (목) 12:32:57 · 4371 · 2
그누보드에서 파일을 무조건 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개

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

그누3 팁자료실

1,026건
+
제목 글쓴이 날짜 조회
05-01-28 조회 4,266
05-01-25 조회 5,174
05-01-24 조회 5,991
05-01-20 조회 5,362
05-01-18 조회 5,423
05-01-17 조회 5,090
05-01-17 조회 3,910
05-01-17 조회 5,165
05-01-15 조회 5,283
05-01-13 조회 5,157
05-01-13 조회 5,054
05-01-13 조회 4,372
05-01-13 조회 4,822
05-01-11 조회 4,523
05-01-11 조회 4,857
05-01-08 조회 3,697
05-01-08 조회 4,521
05-01-07 조회 4,527
05-01-06 조회 4,123
05-01-05 조회 5,204