#include #include #include #include "gd.h" #include "gdfontl.h" main() { /* Declare the image */ gdImagePtr im; /* Declare output files */ FILE *pngout, *jpegout, *in; /* Declare color indexes */ int black; int white; int green; int aqua; int x,y,z; int brect[8]; int startx; int mode; char s[256]; char t[256]; char *image; char qs[2000]; char f[256]; strcpy(f,"/var/lib/httpd/htdocs/theme2/tt0106m_.ttf"); if(getenv("QUERY_STRING") != 0) strcpy(qs,getenv("QUERY_STRING")); else strcpy(qs,""); findtoken("name",qs,t); filter(t,s); findtoken("mode",qs,t); if(t[0] == 0) mode = 0; else mode = atoi(t); gdImageStringFT(NULL,&brect[0],0,f,20,0,0,0,s); /* if(mode == 0) { x= 13*2 + (strlen(s) * gdFontGetLarge()->w); startx = 13; } if(mode == 1) { x= 13 + (strlen(s) * gdFontGetLarge()->w); startx = 13; } if(mode == 2) { x= 13 + (strlen(s) * gdFontGetLarge()->w); startx = 0; } */ startx = 13; x = 13*2 + brect[2] - brect[6]+6; im = gdImageCreate(x, 27); black = gdImageColorAllocate(im, 0, 0, 0); white = gdImageColorAllocate(im, 255, 255, 255); aqua = gdImageColorAllocate(im, 97, 255, 255); if(mode != 2) gdImageFilledArc(im,13,13,25,25,0,360,aqua, gdArc); if(mode != 1) gdImageFilledArc(im,x-14,13,25,25,0,360,aqua, gdArc); gdImageFilledRectangle(im,startx,0,startx + (brect[2] - brect[6] + 6),25, aqua); /* gdImageString(im, gdFontGetLarge(), startx, im->sy / 2 - gdFontGetLarge()->h / 2, s, black); */ gdImageStringFT(im,&brect[0],black,f,20,0.0,startx,23,s); image = gdImageJpegPtr(im, &x, -1); printf("Content-type: image/jpeg\n\n"); for(z=0;z