<./>.dev./hood

function LoadGif($imgname)
{
    /* Attempt to open */
    $im = @imagecreatefromgif($imgname);

    /* See if it failed */
    if(!$im)
    {
        /* Create a blank image */
        $im = imagecreatetruecolor (150, 30);
        $bgc = imagecolorallocate ($im, 255, 255, 255);
        $tc = imagecolorallocate ($im, 0, 0, 0);

        imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);

        /* Output an error message */
        imagestring ($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
    }

    return $im;
}

header('Content-Type: image/gif');

$img = LoadGif('bogus.image');

imagegif($img);
imagedestroy($img);

'Server Side > PHP' 카테고리의 다른 글

파일 내 문자열 읽는 방법  (0) 2016.08.07
PHP 메모리 반환 방법론  (0) 2016.08.07
파라미터 값 $_GET 사용 안하기  (0) 2016.07.29
array_shift 사용방법  (0) 2016.07.29
파일 업로드 레퍼런스  (0) 2016.07.08