Changeset 104

Show
Ignore:
Timestamp:
02/05/06 00:50:10 (3 years ago)
Author:
conrad
Message:

maintain aspect ratio of only one of x or y are given

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fastphoto/trunk/src/cgi.c

    r102 r104  
    7474  params->infile = path_translated; 
    7575  params->outfile = "/tmp/cache.jpg"; 
    76   params->x = FASTPHOTO_DEFAULT_X
    77   params->y = FASTPHOTO_DEFAULT_Y
     76  params->x = 0
     77  params->y = 0
    7878 
    7979  parse_query (params, query_string); 
  • fastphoto/trunk/src/main.c

    r101 r104  
    3535        params.infile = argv[1]; 
    3636        params.outfile = argv[2]; 
    37         params.x = 128
    38         params.y = 128
     37        params.x = 0
     38        params.y = 0
    3939    } 
    4040   
  • fastphoto/trunk/src/resize.c

    r98 r104  
    77{ 
    88  Epeg_Image *im; 
    9   int x, y; 
     9  int x, y, w, h; 
     10 
     11  im = epeg_file_open(params->infile); 
     12 
     13  epeg_size_get (im, &w, &h); 
    1014 
    1115  x = params->x; 
    1216  y = params->y; 
    1317 
    14   im = epeg_file_open(params->infile); 
     18  if (x == 0 && y == 0) { 
     19    x = w; 
     20    y = h; 
     21  } else if (x == 0) { 
     22    x = w*y/h; 
     23  } else if (y == 0) { 
     24    y = h*x/w; 
     25  } 
    1526  epeg_decode_size_set(im, x, y); 
     27 
    1628  epeg_file_output_set(im, params->outfile); 
    1729  epeg_encode(im);