From: b Date: Sat, 24 May 2014 14:01:54 +0000 (+0000) Subject: Online! X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=70d4de3a57c004e6e6785e9bba189861e1437116;p=ott%2Fenhance Online! git-svn-id: svn://botcastle1b/bluenh@2 276fc840-c973-4a23-809e-93696693fc29 --- diff --git a/bluenh.htm b/bluenh.htm new file mode 100644 index 0000000..3997431 --- /dev/null +++ b/bluenh.htm @@ -0,0 +1,33 @@ + + + + ENHANCE! • Bicycles on the Moon + + + + + 1190.bicyclesonthemoon.dnsd.info +

ENHANCE!

+
+ parameter explanation picture
+
+ a=, b=, c=,
+ d=, e=, f=.
+
+ + Enhance by URL
+ URL of image: + +
+
+ Enhance by file upload
+ Upload the image: + + +
+
+
+ Source code available at svn://bicyclesonthemoon.dnsd.info/bluenh (use "e" to login) or http://1190.bicyclesonthemoon.dnsd.info/pro/bluenh. + + + diff --git a/bluenhd.cpp b/bluenhd.cpp new file mode 100644 index 0000000..54ef528 --- /dev/null +++ b/bluenhd.cpp @@ -0,0 +1,124 @@ +// // //Download images and + // // ENHANCE them! + // // + // // Requires cgilib +// // //line 146 of cgi.h + // // must be changed + // // from "extern }" + // // to "}" +// // // + // // ~~bicyclesonthemoon + +#include +#include +#include +#include +#include +#include +#include + +#define WGET_PATH "/usr/bin/wget" +#define ENH_PATH "./bluenh" +#define RM_PATH "/bin/rm" +#define LOG_PATH "/eizm/log/bluenh/bluenh.log" +#define USERAGENT "Bluenhancement\x20(1190.bicyclesonthemoon.dnsd.info/bluenh/bluenh.htm)" +#define MSTD_PATH "/pro/bluenh/nh.png" + +int main (int argc, char *argv[]); +void mustard(int mustard); + +FILE *pix; +unsigned char buf[1024]; +char url[1024]; +char path[256]; +char method[256]; +s_cgi *cgi; +int t; +pid_t sub; +struct stat st; +unsigned long p; +unsigned short q; +char **up; +// unsigned char a,b,c,d,e,f; +// bool meg=false; + +int main (int argc, char *argv[]) +{ + cgi=cgiInit(); + + up=cgiGetFiles(cgi); + if (up) + { + sprintf(path,"%s",cgiGetFile(cgi,up[0])->tmpfile); + sprintf(url,"%s",cgiGetFile(cgi,up[0])->filename); + } + else + { + sprintf(url,"%s",(cgiGetValue(cgi,"inpix")!=NULL)?(cgiGetValue(cgi,"inpix")):""); + sprintf(path,"/var/tmp/%lu",(unsigned long)getpid()); + + //Why is there no spawnl() in linux? + sub=fork(); + if(sub==0) + { + t=execl(WGET_PATH,WGET_PATH,"-q","-t","2","-U",USERAGENT,"-O",path,url,(char *)0); + exit(t); + } + waitpid(sub,&t,0); + if(t)mustard(t); + } + + sub=fork(); + if(sub==0) + { + t=execl(ENH_PATH,ENH_PATH,path,path,cgiGetValue(cgi,"a")!=NULL?cgiGetValue(cgi,"a"):"0",cgiGetValue(cgi,"b")!=NULL?cgiGetValue(cgi,"b"):"127",cgiGetValue(cgi,"c")!=NULL?cgiGetValue(cgi,"c"):"255",cgiGetValue(cgi,"d")!=NULL?cgiGetValue(cgi,"d"):"0",cgiGetValue(cgi,"e")!=NULL?cgiGetValue(cgi,"e"):"127",cgiGetValue(cgi,"f")!=NULL?cgiGetValue(cgi,"f"):"255","q",(char *)0); + exit(t); + } + waitpid(sub,&t,0); + if(t)mustard(t); + + pix=fopen(path,"rb"); + if(pix==NULL) + mustard(123); + fstat(fileno(pix),&st); + p=st.st_size/1024; + q=st.st_size%1024; + + printf("Content-Length: %lu\n",(unsigned long)(st.st_size)); + printf("Content-type: image/png\n\n"); + for(unsigned long i=0;i