thumb 디렉토리에 파일이 생기지 않는 현상 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

thumb 디렉토리에 파일이 생기지 않는 현상 정보

thumb 디렉토리에 파일이 생기지 않는 현상

첨부파일

list.skin.php (12.7K) 3회 다운로드 2010-05-04 11:56:23

본문

게시판 스킨을 gallery로 바꾸고 이미지를 올리면 리스트가 나오지 않고 아래 에러가 표시됩니다.
Fatal error: Call to undefined function imagecreatefromjpeg() in /지정디렉토리/skin/board/gallery/list.skin.php on line 76

지금까지 파악된 원인은 파일이 저장되는 경로인 data/file/지정디렉토리/에 thumb라는 디렉토리가 생기도록 되어있는것 같은데 여기에 무슨 숫자파일이 생성되지 않아서 그런것 같아요. 왜 안생기는지 이유만 알면 될것 같은데 이유를 모르겠어요.. 아시는분 알려 주시면 고맙겠습니다.

참고로 일반 basic 게시판에서는 리스트나 이미지가 정상적으로 나타납니다. 서버에 이미지파일도 들어 있고요. 서버는 레드햇 리눅스 입니다.

76 line이 있는 list.skin.php 소스 일부분

$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb))
{
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
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); //<= 76라인
else if ($size[2] == 3)
$src = imagecreatefrompng($file);
else
break;
  • 복사

댓글 전체

폴더 만드는 부분과 권한설정은 이렇게 되어있어요. (보통 gallery 스킨과 별차이 없는것 같아요)
----------------------------------------------------------------------------
$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';

@mkdir($thumb_path, 0707);
@chmod($thumb_path, 0707);
-----------------------------------------------------------------------------
$thumb = $thumb_path.'/'.$list[$i][wr_id];
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb))
{
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
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
break;



/* rate 계산,, 썸네일은 가로 정렬임으로 세로가 동일해야 함 */
/*
$rate = $board[bo_1] / $size[0];
$height = (int)($size[1] * $rate);

$dst = imagecreatetruecolor($board[bo_1], $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_1], $height, $size[0], $size[1]);
imagepng($dst, $thumb_path.'/'.$list[$i][wr_id], $board[bo_2]);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
*/

$rate = $board[bo_2] / $size[1];
$width = (int)($size[0] * $rate);

//echo "rate : $rate ,width : $width, $height : $board[bo_2] <br>";
if($width <= $board[bo_1]) { //width가 지정된 사이즈보다 작을경우 rate 비율로 썸네일 생성
$dst = imagecreatetruecolor($width, $board[bo_2]);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $width, $board[bo_2], $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $board[bo_2]);
} else {
$rate = $board[bo_1] / $size[0];
$height = (int)($size[1] * $rate);

$dst = imagecreatetruecolor($board[bo_1], $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_1], $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $board[bo_2]);
}

chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
© SIRSOFT
현재 페이지 제일 처음으로