그누 첨부파일 이미지 경로 문제
본문
첨부파일로 이미지를 올리면요
도메인/data/file/board/5ACB8B3BAB8B5E5_C0CCB9CCC1F6.jpg
이런식으로 뜨진아요
도메인이 여러개라 도메인을 부분을 제가 강제로 지정하고 싶은데
어느파일을 수정해야 할까요? 도움부탁드립니다
답변 4
$row['bf_type'] 변수가 첨부파일 유형이므로 조건문을 사용하여 변경하시면 됩니다.
// bf_type이 1(gif), 2(jpg), 3(png)일 경우
if(in_array($row['bf_type'], array(1, 2, 3)) == true){
$file[$no][path] = "http://domain.com/data/file/$bo_table";
} else{
$file[$no][path] = "$g4[path]/data/file/$bo_table";
}
이미지는 말그대로 해당 이미지가 업로드 된 주소입니다.
도메인주소를 바꾸면 해당 도메인에 이미지가 있지 않는이상 이미지가 보여지지 않죠.
도메인을 임의로 지정한다 하는 말씀이 이해가 되질 않네요.
config.php 30라인에 있습니다.
define('G5_DOMAIN', '');
lib > common.lib.php 파일에서 get_file 함수를 찾아서 수정하시면 될 듯 하네요.
// 게시글에 첨부된 파일을 얻는다. (배열로 반환)
function get_file($bo_table, $wr_id)
{
global $g4, $qstr;
$file["count"] = 0;
$sql = " select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$no = $row[bf_no];
$file[$no][href] = "./download.php?bo_table=$bo_table&wr_id=$wr_id&no=$no" . $qstr;
$file[$no][download] = $row[bf_download];
// 4.00.11 - 파일 path 추가
$file[$no][path] = "$g4[path]/data/file/$bo_table";
//$file[$no][size] = get_filesize("{$file[$no][path]}/$row[bf_file]");
$file[$no][size] = get_filesize($row[bf_filesize]);
//$file[$no][datetime] = date("Y-m-d H:i:s", @filemtime("$g4[path]/data/file/$bo_table/$row[bf_file]"));
$file[$no][datetime] = $row[bf_datetime];
$file[$no][source] = addslashes($row[bf_source]);
$file[$no][bf_content] = $row[bf_content];
$file[$no][content] = get_text($row[bf_content]);
//$file[$no][view] = view_file_link($row[bf_file], $file[$no][content]);
$file[$no][view] = view_file_link($row[bf_file], $row[bf_width], $row[bf_height], $file[$no][content]);
$file[$no][file] = $row[bf_file];
// prosper 님 제안
//$file[$no][imgsize] = @getimagesize("{$file[$no][path]}/$row[bf_file]");
$file[$no][image_width] = $row[bf_width] ? $row[bf_width] : 640;
$file[$no][image_height] = $row[bf_height] ? $row[bf_height] : 480;
$file[$no][image_type] = $row[bf_type];
$file["count"]++;
}
return $file;
}
$file[$no][path] = "$g4[path]/data/file/$bo_table";
이 부분을 찾아서 $g4[path] 대신에 도메인을 고정해보세요~
!-->
답변을 작성하시기 전에 로그인 해주세요.