서버 이전시 썸네일에서 에러 출력시 > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

서버 이전시 썸네일에서 에러 출력시 정보

서버 이전시 썸네일에서 에러 출력시

본문

// 파일을 업로드 했다면
 if (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);

        unlink($file);
        // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면
        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]);
        imagepng($dst, $file, $img_quality);
        chmod($file, 0606);
}


warning: getimagesize(): PNG file corrupted by ASCII conversion in /home/wteastuk/public_html/new/includes/theme.inc on line 519.
경고의 메세지를 출력합니다. 이유는 간단하죠

ftp다운 혹은 업로드시 썸네일 파일은 바이너리로 해야 합니다.

참고
http://drupal.org/node/68799

Thanks for the tip, but

Talib - June 13, 2006 - 20:44

Thanks for the tip, but although I tried, I couldn't rectify it by deleting the image and uploading it again via binay mode (using Smart FTP).

추천
0

댓글 1개

전체 21 |RSS
그누4 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT