Contents

조회 수 16375 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
제가 전에 했던 작업중 샘플입니다.
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);
}


?

  1. [c++][mfc] 파일 입출력 샘플 (한줄씩 읽어서 다른 파일에 쓰기)

    Date2013.04.23 CategoryDevelop Byhooni Views16164
    Read More
  2. [web] URL 인코딩 방법.. 테이블.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views16276
    Read More
  3. [android] 안드로이드 어플 모음 ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views16340
    Read More
  4. [mysql] 쿼리 실행시 ERROR 1366 (HY000) : incorrect string value : for column

    Date2017.03.30 CategoryDatabase Byhooni Views16346
    Read More
  5. [js] 간단한 게임 프로토타입 (HTML5 와는 무관)

    Date2013.04.23 CategoryDevelop Byhooni Views16356
    Read More
  6. [js] 수학 공식을 제공하는 Math 객체

    Date2013.04.23 CategoryDevelop Byhooni Views16363
    Read More
  7. [c] GD라이브러리(jpeg)를 사용한 웹 카운터 샘플

    Date2013.04.23 CategoryDevelop Byhooni Views16375
    Read More
  8. [sql] 간단한 통계 서브쿼리 예제..

    Date2013.04.23 CategoryDatabase Byhooni Views16424
    Read More
  9. [ios] UIWebView에서 NSURLRequest에 Cookie 실어 보내기

    Date2014.01.16 CategoryDevelop Byhooni Views16438
    Read More
  10. [router] 설정과 기본 명령어들 모음

    Date2013.04.23 CategorySystem/OS Byhooni Views16452
    Read More
  11. [linux] 센드메일 동적릴레이 설치

    Date2003.04.23 CategorySystem/OS Byhooni Views16468
    Read More
  12. [linux] 쉘스크립트 expr

    Date2014.03.11 CategorySystem/OS Byhooni Views16470
    Read More
Board Pagination Prev 1 ... 70 71 72 73 74 75 76 77 78 79 ... 99 Next
/ 99