파일 절대경로
본문
게시판 view 페이지에서
첫번째 파일만 빼고 나머지들은 작게 나오려고 하는 중인데요.
이미지들이 X박스가 떠서 속성들어가서 이미지 주소를 확인해보니
이런식으로 절대경로까지 포함되서 나오네요.
어딜 수정해야하는걸까요..
아래는 썸네일 불러오는 코드입니다.
<?
$sql = " select bf_file from $g5[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' order by bf_no limit 0, 10 ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
//썸네일 코드 시작
$data_path = G5_PATH. "/data/file/{$bo_table}";//라이브러리 파일 참조
$filename = $row[bf_file]; //파일명
$thumb_path = G5_PATH.'/data/file/'.$bo_table;
$view_w = 90; //썸네일 가로사이즈
$view_h = 70; //썸네일 세로사이즈
$sch_q = 100; //썸네일 퀼리티
if (!is_dir($thumb_path)) {
@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
}
$filename = $row['bf_file'];
$thumb = $thumb_path.'/'.$filename; //썸네일
if (!file_exists($thumb))
{
$file = $data_path.'/'.$filename; //원본
if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file))
{
$size = getimagesize($file);
if ($size[2] == 1)
$src = imagecreatefromgif($file);
else if ($size[2] == 2)
$src = imagecreatefromjpeg($file);
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
continue;
$rate = $view_w / $size[0];
$height = (int)($size[1] * $rate);
if ($height < $view_h)
$dst = imagecreatetruecolor($view_w, $height);
else
$dst = imagecreatetruecolor($view_w, $view_h);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $view_w, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$filename, $sch_q);
chmod($thumb_path.'/'.$filename, 0707);
}
}
if (file_exists($thumb) && $filename) {
?>
<a href=javascript:void(0); onClick=View_Open('#')" onMouseOver="bgChange('view_img{$i}');" onMouseOut="bgChange(view_img{$i}');"><img src='<?=$thumb?>' border=1 width=90 height=70 style="border-color:#d5d5d5;"></a>
<?
}
}
?>
!-->
답변을 작성하시기 전에 로그인 해주세요.