핸드폰 사진 업로드시 에러 질문입니다. > 그누4 질문답변

그누4 질문답변

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

핸드폰 사진 업로드시 에러 질문입니다. 정보

핸드폰 사진 업로드시 에러 질문입니다.

본문

핸드폰으로 찍은 사진을 갤러리에 올릴 때 본문에 사진은 잘 보여지지만
리스트에는 썸네일이 표시되지 않고 그 위에

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Corrupt JPEG data: 143 extraneous bytes before marker 0xd9 in /home/hosting_users/도메인명/www/skin/board/gallery/skin.lib.php on line 79

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '../data/file/bb_photo/2952592070_KPozwsHd_2012-06-19_19.21.20.jpg' is not a valid JPEG file in /home/hosting_users/도메인명/www/skin/board/gallery/skin.lib.php on line 79


이런 에러메세지가 출력됩니다.

딱히 모바일 전용 홈페이지가 있는것도 아니고 하나의 웹페이지를 사용하고 있습니다.
웹상에서 업로드시 정상적으로 썸네일이 생성되고 출력되는데
핸드폰으로 업로드한 사진은 썸네일 생성이 안되고 에러메세지가 뜨네요.


해당 갤러리의 skin.lib.php 본문입니다.
------------------------------------------------------------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가


if (!function_exists("makeThumbs")) {

function makeThumbs($oriPath, $oriFileName, $thmWidth="", $thmHeight="", $thmAlt="") {
global $g4, $board_skin_path;

$errorFilePrt = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";

$oriFile = $oriPath . "/" . $oriFileName;
if (is_file($oriFile) == false) return $errorFilePrt; // 원본 부재

$thmPath = $oriPath . "/thumbs";
$thmFile = $thmPath . "/" . $oriFileName;

$oriSize = getimagesize($oriFile);
$oriWidth = $oriSize[0];
$oriHeight = $oriSize[1];
$oriType = $oriSize[2];

if ($oriType > 3) return $errorFilePrt; // 원본 이미지 타입 오류

$oriRate = $oriWidth / $oriHeight;

if ($thmWidth == "" && $thmHeight == "") return $errorFilePrt; // 썸네일 사이즈 미지정

if ($thmWidth == "") $thmWidth = $thmHeight * $oriRate;
if ($thmHeight == "") $thmHeight = $thmWidth / $oriRate;

$widthRate = $thmWidth / $oriWidth;
$heightRate = $thmHeight / $oriHeight;

$oriFilePrt = "<img src=\"{$oriFile}\" width=\"{$oriWidth}\" height=\"{$oriHeight}\" border=\"0\" alt=\"{$thmAlt}\" />";

if ($widthRate >= 1 && $heightRate >= 1) { // 리사이징 불필요
return $oriFilePrt;
}

if (file_exists($thmFile)) { // 썸네일 유무
$fp = fopen($thmFile, "r");
$fstat = fstat($fp);
$thmFileTime = $fstat['ctime'];
fclose($fp);

$fp = fopen($oriFile, "r");
$fstat = fstat($fp);
$oriFileTime = $fstat['ctime'];
fclose($fp);

if ($thmFileTime > $oriFileTime) { // 썸네일 갱신 불필요
$thmSize = getimagesize($thmFile);
$thmFilePrt = "<img src=\"{$thmFile}\" width=\"{$thmSize[0]}\" height=\"{$thmSize[1]}\" border=\"0\" alt=\"{$thmAlt}\" />";
} else {
@unlink($thmFile);
}
}

@mkdir($thmPath);
@chmod($thmPath, 0707);

if ($widthRate < $heightRate) {
$tempWidth = (int)($oriWidth * $heightRate);
$tempHeight = $thmHeight;
} else {
$tempWidth = $thmWidth;
$tempHeight = (int)($oriHeight * $widthRate);
}

if ($tempWidth == "") $tempWidth = $thmWidth;
if ($tempHeight == "") $tempHeight = $thmHeight;

switch($oriType) {
case(1) :
if(function_exists('imagecreateFromGif')) $tempImage = imagecreateFromGif($oriFile);
break;
case(2) :
if(function_exists('imagecreateFromJpeg')) $tempImage = imagecreateFromJpeg($oriFile); <--79번 라인
break;
case(3) :
if(function_exists('imagecreateFromPng')) $tempImage = imagecreateFromPng($oriFile);
break;
    case(4) :
if(function_exists('imagecreateFromBmp')) $tempImage = imagecreateFromBmp($oriFile);
break;

}

if ($tempImage) {
if (function_exists('imagecreatetruecolor')) {
$tempCanvas = imagecreatetruecolor($thmWidth, $thmHeight);
} else {
$tempCanvas = imagecreate($thmWidth, $thmHeight);
}

if (function_exists('imagecopyresampled')) {
imagecopyresampled($tempCanvas, $tempImage, 0, 0, 0, 0, $tempWidth, $tempHeight, ImageSX($tempImage), ImageSY($tempImage));
} else {
imagecopyresized($tempCanvas, $tempImage, 0, 0, 0, 0, $tempWidth, $tempHeight, ImageSX($tempImage), ImageSY($tempImage));
}
ImageDestroy($tempImage);
ImageJpeg($tempCanvas, $thmFile, 100);
ImageDestroy($tempCanvas);
unset($tempImage, $tempCanvas);
}

$thmFilePrt = "<img src=\"{$thmFile}\" width=\"{$thmWidth}\" height=\"{$thmHeight}\" border=\"0\" alt=\"{$thmAlt}\" />";

return $thmFilePrt;
}
}
?>
----------------------------------------------------------------------------------------
그누보드는 4.36.02 버전으로 업데이트했으며
현재 쓰고 있는 갤러리는 예전에 스킨을 다운받아 사용중입니다.


워낙 초보라 겨우 찾아서 붙여넣는 정도의 실력입니다.
번거로우시겠지만 자세한 수정 내용 부탁드립니다 ㅠㅠ;;
  • 복사

댓글 전체

질문 올리고서도 이리저리 찾아보다 해결했습니다.
에러난 79라인 윗줄에

$im = @imagecreatefromstring( $imageString );
ini_set("gd.jpeg_ignore_warning", true);

이 두줄을 추가하니 되는군요 'ㅂ'
© SIRSOFT
현재 페이지 제일 처음으로