/c_code/captcha.c
C | 27 lines | 25 code | 2 blank | 0 comment | 2 complexity | a261308c4297e7a097e0a98a82bf4020 MD5 | raw file
1#include <gd.h> 2#include "gdfontl.h" 3#include "gdfontg.h" 4#include <string.h> 5 6int main(int argc, char **argv) { 7 gdImagePtr im; 8 int black; 9 int white; 10 char *s; 11 if (argc > 1) { 12 s = argv[1]; 13 } else { 14 return 1; 15 }; 16 17 im = gdImageCreate(100, 50); 18 white = gdImageColorAllocate(im, 255, 255, 255); 19 black = gdImageColorAllocate(im, 0, 0, 0); 20 gdImageString(im, gdFontGiant, 21 im->sx / 2 - (strlen(s) * gdFontGetGiant()->w / 2), 22 im->sy / 2 - gdFontGetGiant()->h / 2, 23 s, black); 24 gdImagePng(im, stdout); 25 gdImageDestroy(im); 26 return 0; 27}