Contents

Views 15128 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
제가 전에 했던 작업중 샘플입니다.
Web상에서 Counter를 jpeg로 만들어서 뿌려주던 것입니다. 

#include "gd.h" 
#include "gdfontl.h"
    
void outCounter(long lTotal, long lToday)
{   
    gdImagePtr im;
    FILE *pngout, *jpegout;
    int black, white, back, blue;
    int nTextColor;

    int brect[8];
    int x, y, nXTop, nYLeft;
    int nSizeX, nSizeY;
    char s[40];
    char *f = "/usr/share/fonts/user/hatten.ttf";
    double sz = 12.;
    char *err; 

    sprintf(s, "Today:%08ld / Total:%08ld", lToday, lTotal);
    err = gdImageStringTTF(NULL,&brect[0],0,f,sz,0.,0,0,s);
    
    nSizeX = 180;
    nSizeY = brect[3]-brect[7] + 6;
    
    im = gdImageCreate(nSizeX, nSizeY);

    black = gdImageColorAllocate(im, 0, 0, 0);
    white = gdImageColorAllocate(im, 255, 255, 255);
    back = gdImageColorAllocate(im, 200, 200, 200);
    blue = gdImageColorAllocate(im, 211, 212, 223);
    nTextColor = gdImageColorAllocate(im, 12, 4, 89);

    gdImageFill(im, 1, 1, blue);

    nXTop = 5-brect[6];
    nYLeft = 13; 

    err = gdImageStringTTF(im,&brect[0],nTextColor,f,sz,0.0,nXTop,nYLeft,s);
    if (err) {fprintf(stderr,err); return;}
    
    printf("Content-type: image/jpeg\n\n");
    gdImageJpeg(im, stdout, -1);
    
    gdImageDestroy(im);
}


?

List of Articles
No. Category Subject Author Date Views
193 Develop [js] 사라지는 브라우저 hooni 2003.04.23 6879
192 Develop [js] 사진첩에 쓸 내용 - 마우스 오버로 바꾸기 hooni 2013.04.23 6363
191 Develop [js] 새로고침(refresh)방법과 다른 페이지 바꾸기.. hooni 2003.04.23 6565
190 Develop [js] 서서히 나타나는 화면.. ㅋㅋ hooni 2013.04.23 6228
189 Develop [js] 셀렉트박스(select)의 옵션(option) 동적으로 추가/제거 file hooni 2013.04.23 8080
188 Develop [js] 수명체크 프로그램 ㅋㅋ file hooni 2013.04.23 6904
187 Develop [js] 수학 공식을 제공하는 Math 객체 hooni 2013.04.23 15439
186 Develop [js] 순환참조에 의한 메모리 누수 관련 file hooni 2013.12.17 10863
185 Develop [js] 숫자만 입력하게 하는 자바스크립트 hooni 2013.04.23 6863
184 Develop [js] 스크롤 이벤트 막기 hooni 2015.04.14 1092
183 Develop [js] 스크롤을 포함한 마우스 위치 찾는 코드 hooni 2003.04.23 8546
182 Develop [js] 스타크래프트(starcraft).. file hooni 2013.04.23 6673
Board Pagination Prev 1 ... 50 51 52 53 54 55 56 57 58 59 ... 71 Next
/ 71