Changeset 98
- Timestamp:
- 02/04/06 23:47:52 (3 years ago)
- Files:
-
- fastphoto/trunk/src/cgi.c (modified) (1 diff)
- fastphoto/trunk/src/cgi.h (modified) (1 diff)
- fastphoto/trunk/src/fastphoto.c (modified) (2 diffs)
- fastphoto/trunk/src/fastphoto.h (added)
- fastphoto/trunk/src/resize.c (modified) (1 diff)
- fastphoto/trunk/src/resize.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
fastphoto/trunk/src/cgi.c
r97 r98 2 2 #include <stdlib.h> 3 3 4 #include "fastphoto.h" 5 4 6 #define CONTENT_TYPE_JPEG "Content-Type: image/jpeg\n\n" 7 8 static char * path_translated; 9 static char * query_string; 10 11 int 12 cgi_init (fastphoto_t * params) 13 { 14 char * gateway_interface; 15 16 gateway_interface = getenv ("GATEWAY_INTERFACE"); 17 if (gateway_interface == NULL) { 18 return 0; 19 } 20 21 path_translated = getenv ("PATH_TRANSLATED"); 22 query_string = getenv ("QUERY_STRING"); 23 24 params->infile = path_translated; 25 params->outfile = "/tmp/cache.jpg"; 26 params->x = 128; 27 params->y = 128; 28 29 return 1; 30 } 5 31 6 32 int fastphoto/trunk/src/cgi.h
r97 r98 2 2 #define __CGI_H__ 3 3 4 #include "fastphoto.h" 5 6 int cgi_init (fastphoto_t * params); 4 7 int content_type_jpeg (void); 5 8 fastphoto/trunk/src/fastphoto.c
r97 r98 1 1 #include <stdio.h> 2 2 #include <stdlib.h> 3 #include <string.h> 3 4 5 #include "fastphoto.h" 4 6 #include "cgi.h" 5 7 #include "resize.h" … … 10 12 main (int argc, char * argv[]) 11 13 { 12 char * infile, * outfile; 13 char * query_string; 14 fastphoto_t params; 14 15 15 content_type_jpeg ();16 memset (¶ms, 1, sizeof (fastphoto_t)); 16 17 17 query_string = getenv ("QUERY_STRING");18 if (cgi_init(¶ms)) { 18 19 19 infile = getenv ("PATH_TRANSLATED"); 20 outfile = "/tmp/cache.jpg"; 21 resize (infile, outfile, 128, 128); 20 } else { 21 params.infile = argv[1]; 22 params.outfile = argv[2]; 23 params.x = 128; 24 params.y = 128; 25 } 26 27 resize (¶ms); 22 28 23 29 return 0; fastphoto/trunk/src/resize.c
r93 r98 1 1 #include <Epeg.h> 2 2 3 #include "fastphoto.h" 4 3 5 void 4 resize ( char * infile, char * outfile, int x, int y)6 resize (fastphoto_t * params) 5 7 { 6 8 Epeg_Image *im; 9 int x, y; 7 10 8 im = epeg_file_open(infile); 11 x = params->x; 12 y = params->y; 13 14 im = epeg_file_open(params->infile); 9 15 epeg_decode_size_set(im, x, y); 10 epeg_file_output_set(im, outfile);16 epeg_file_output_set(im, params->outfile); 11 17 epeg_encode(im); 12 18 epeg_close(im); fastphoto/trunk/src/resize.h
r93 r98 2 2 #define __RESIZE_H__ 3 3 4 void resize (char * infile, char * outfile, int x, int y); 4 #include "fastphoto.h" 5 6 void resize (fastphoto_t * params); 5 7 6 8 #endif /* __RESIZE_H__ */
