Google
Web alhem.net
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

fiximage.cpp File Reference

#include <mysql/mysql.h>
#include <libmysqlwrapped.h>
#include <libibank.h>
#include <libcgi++.h>

Include dependency graph for fiximage.cpp:

Include dependency graph

Go to the source code of this file.

Functions

int main (int argc, char *argv[])


Function Documentation

int main int  argc,
char *  argv[]
 

File ......... fiximage.cpp Published .... 2004-07-09 Author ....... grymse@alhem.net

Definition at line 29 of file fiximage.cpp.

00030 { 00031 Database db("localhost","root","","ibank"); 00032 Query q(db); 00033 Base64 bomb; 00034 00035 q.get_result("select * from image"); 00036 while (q.fetch_row()) 00037 { 00038 db::Image image(&db, &q); 00039 00040 printf("%s\n",image.filename.c_str()); 00041 unlink("/tmp/tn.gif"); 00042 unlink("/tmp/geometry"); 00043 00044 while (image.image_tn.size()) 00045 { 00046 std::vector<std::string>::iterator it = image.image_tn.begin(); 00047 image.image_tn.erase(it); 00048 } 00049 bomb.decode_to_file(image.image_data, (char *)image.filename.c_str()); 00050 size_t x = 0; 00051 size_t y = 0; 00052 { 00053 FILE *fil; 00054 char cmd[1000]; 00055 sprintf(cmd,"%s -verbose -geometry 128 %s /tmp/tn.gif 2>/tmp/geometry",_CONVERT,image.filename.c_str()); 00056 system( cmd ); 00057 if ((fil = fopen("/tmp/geometry", "rt")) != NULL) 00058 { 00059 fgets(cmd, 1000, fil); 00060 while (!feof(fil)) 00061 { 00062 Parse pa(cmd); 00063 pa.getword(cmd); // file=>file 00064 if (!strncmp(cmd,image.filename.c_str(),image.filename.size())) 00065 { 00066 pa.getword(); // type 00067 pa.getword(cmd); // geometry XxY 00068 { 00069 Parse pa(cmd,"x="); 00070 x = pa.getvalue(); 00071 y = pa.getvalue(); 00072 break; 00073 } 00074 } 00075 // 00076 fgets(cmd, 1000, fil); 00077 } 00078 fclose(fil); 00079 } 00080 } 00081 bomb.encode_from_file( "/tmp/tn.gif", image.image_tn); 00082 image.xsize = x; 00083 image.ysize = y; 00084 image.save(); 00085 unlink("/tmp/tn.gif"); 00086 unlink("/tmp/geometry"); 00087 } 00088 q.free_result(); 00089 00090 }


Generated on Sat Feb 12 00:14:57 2005 for IBank by doxygen 1.3.7