summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-05-10 17:08:49 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-05-10 17:08:49 -0400
commitcc7e38d81b190ea6160cd5dee544ab2f0bfb8b51 (patch)
treec189188d0d4e67e5bcd4f1087944585ac0cd44fe
parent4f8e27dde3cfb7d82180d8dfbfcadec74c5b7967 (diff)
downloadwebpage-cc7e38d81b190ea6160cd5dee544ab2f0bfb8b51.tar.gz
webpage-cc7e38d81b190ea6160cd5dee544ab2f0bfb8b51.tar.bz2
webpage-cc7e38d81b190ea6160cd5dee544ab2f0bfb8b51.zip
Trying to copy image to absolute path
-rw-r--r--ws2a/gencaptcha.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ws2a/gencaptcha.c b/ws2a/gencaptcha.c
index cdb669d..de5729c 100644
--- a/ws2a/gencaptcha.c
+++ b/ws2a/gencaptcha.c
@@ -77,14 +77,15 @@ int main(){
sprintf(command,"convert \"/home/git/wswebpage/ws2a/captchas/%lu.png\" -virtual-pixel White -distort Arc %d \"/home/git/wswebpage/ws2a/captchas/%lu.png\"",rhash,arcdis,rhash);
system(command);
- printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10);
- printf("%lu",rhash);
- /*
FILE* imgfile;
+ FILE* tofile;
char filepath[100];
- sprintf(filepath,"../ws2a/captchas/%lu.png",hash(randwords));
+ char tofilepath[100];
+ sprintf(filepath,"../ws2a/captchas/%lu.png",rhash);
+ sprintf(tofilepath,"/home/git/wswebpage/ws2a/captchas/%lu.png",rhash);
//printf("Filepath:%s",filepath);
imgfile = fopen(filepath,"rb");
+ tofile = fopen(tofilepath,"wb");
if(imgfile == NULL){
printf("Unable to open file!");
return 1;
@@ -101,13 +102,17 @@ int main(){
return 1;
}
fread(buffer, filelen, 1, imgfile);
+ fclose(imgfile);
//printf("%s%c%c\n","Content-Type:image/png",13,10);
int i = 0;
while(i < filelen){
- printf("%c",buffer[i]);
+ fprintf(tofile,"%c",buffer[i]);
i++;
}
free(buffer);
+ fclose(tofile);
+ printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10);
+ printf("%lu",rhash);
/*
char c;
while((c = fgetc(imgfile)) && !feof(imgfile)){