최근글 썸네일 추출이 안되네요. 이건 무엇이 문제일까요? 정보
최근글 썸네일 추출이 안되네요. 이건 무엇이 문제일까요?- sandinista 자기소개 아이디로 검색 회원게시물
- 777
본문
최근글 썸네일 추출이 안되네요. 이건 무엇이 문제일까요?
noimage 만 나오네요.
아래 볼드로 처리된
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
가 문제인거 같은데.
echo $list[$i][file][0][path];
echo $list[$i][file][0][file];
해봐도 데이터가 안나옵니다. 물론 사진은 여러장 첨부되어 있지요.
썸네일 들어가는 폴더에 아무파일도 생성되지 않습니다.
혹시 원인이나 해결방법을 알고 계신 분들 꼭 좀 도움부탁드립니다.
참고로 썸네일 추출코드는 제가 하나도 안걸들였거든요.
원 소스 그대로인데.. 왜 그럴까요./
GD등 관련 라이브러리도 제대로 돌아가는 것을 확인했습니다.
--------------------------------------------------------------------------
$thumb = $thumb_path.'/'.$list[$i][wr_id];
//echo $thumb;
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
echo $list[$i][file][0][path];
// 업로드된 파일이 이미지라면
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 = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
noimage 만 나오네요.
아래 볼드로 처리된
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
가 문제인거 같은데.
echo $list[$i][file][0][path];
echo $list[$i][file][0][file];
해봐도 데이터가 안나옵니다. 물론 사진은 여러장 첨부되어 있지요.
썸네일 들어가는 폴더에 아무파일도 생성되지 않습니다.
혹시 원인이나 해결방법을 알고 계신 분들 꼭 좀 도움부탁드립니다.
참고로 썸네일 추출코드는 제가 하나도 안걸들였거든요.
원 소스 그대로인데.. 왜 그럴까요./
GD등 관련 라이브러리도 제대로 돌아가는 것을 확인했습니다.
--------------------------------------------------------------------------
$thumb = $thumb_path.'/'.$list[$i][wr_id];
//echo $thumb;
// 썸네일 이미지가 존재하지 않는다면
if (!file_exists($thumb)) {
$file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];
echo $list[$i][file][0][path];
// 업로드된 파일이 이미지라면
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 = $img_width / $size[0];
$height = (int)($size[1] * $rate);
// 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
if ($height < $img_height)
// 계산된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $height);
else
// 설정된 이미지 높이로 복사본 이미지 생성
$dst = imagecreatetruecolor($img_width, $img_height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);
imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);
chmod($thumb_path.'/'.$list[$i][wr_id], 0606);
}
}
댓글 전체
echo 해도 나오지 않는다면 위 소스 윗부분 조건문에서 내용을 처리하지 않도록 하고있겠죠