#include #include #include "gd.h" FILE *logfile; struct parameter { char piece[256]; char rotate[256]; char x[256]; char y[256]; } html_error() { printf("Content-type: text/html\n\n"); printf("File open error"); exit(1); } void parse_extra(char *extra_path, struct parameter paramlist[]) { char *charp,*slash1,*slash2,*slash3,*slash4; int i=0,j,k; for(j=1;jsx/2), atoi(paramlist[j].y)-(piece_image->sy/2), 0,0, piece_image->sx,piece_image->sy); gdImageDestroy(piece_image); j++; } printf("Content-type: multipart/x-mixed-replace;boundary=ThisRandomString\n"); printf("\n--ThisRandomString\n"); printf("Content-type: image/gif\n\n"); gdImageGif(output_image,stdout); printf("\n--ThisRandomString\n"); gdImageDestroy(output_image); } else /* called as imagemap */ { extra_path = getenv("PATH_INFO"); comma = strchr(argv[1],','); if(!comma) html_error(); *comma = 0; printf("Content-type: text/html\n\n"); printf("\n"); printf("
\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n", extra_path, argv[1], comma+1); printf("\n"); printf("\n"); printf("\n", extra_path, argv[1], comma+1, extra_path, argv[1], comma+1); printf("\n"); printf("\n"); printf("\n"); printf("\n"); printf("
Choose a piece
\n"); printf("
\n"); /* printf("\n", extra_path, argv[1], comma+1); */ } }