Honour per-photo default settings.
This commit is contained in:
parent
39821e03e6
commit
dcada45e31
26
src/main.c
26
src/main.c
@ -366,19 +366,19 @@ void photo_handler( struct gallery_info* gallery,
|
||||
/* Are we asked to show the original image? */
|
||||
int original = hdf_get_int_value( cgi->hdf, "Query.original", 0 );
|
||||
|
||||
/* Default sizes depend on if we're looking at a panorama or not. */
|
||||
int default_width = DEFAULT_WIDTH;
|
||||
int default_height = DEFAULT_HEIGHT;
|
||||
if ( photo->meta.aspect_ratio >= PANORAMA_ASPECT_RATIO ) {
|
||||
dputs("photo_handler: detected panorama photo\n");
|
||||
default_width = PANORAMA_DEFAULT_WIDTH;
|
||||
default_height= PANORAMA_DEFAULT_HEIGHT;
|
||||
}
|
||||
int default_width = photo->default_dims.width;
|
||||
int default_height = photo->default_dims.height;
|
||||
|
||||
/* Pull the size/quality information out of the GET variables. */
|
||||
int width = hdf_get_int_value( cgi->hdf, "Query.width", default_width );
|
||||
int height = hdf_get_int_value( cgi->hdf, "Query.height", default_height );
|
||||
int quality = hdf_get_int_value( cgi->hdf, "Query.quality", DEFAULT_QUALITY );
|
||||
/*
|
||||
* Pull the size/quality information out of the GET variables.
|
||||
* Default to the photo's defaults if we aren't sent any.
|
||||
*/
|
||||
int width = hdf_get_int_value( cgi->hdf, "Query.width",
|
||||
photo->default_dims.width );
|
||||
int height = hdf_get_int_value( cgi->hdf, "Query.height",
|
||||
photo->default_dims.height );
|
||||
int quality = hdf_get_int_value( cgi->hdf, "Query.quality",
|
||||
photo->default_quality );
|
||||
|
||||
/* MAX SIZE: Allow images no bigger than a 2048 pixel square */
|
||||
if ( width > MAX_WIDTH ) width = MAX_WIDTH;
|
||||
@ -394,7 +394,7 @@ void photo_handler( struct gallery_info* gallery,
|
||||
* string then call atof on it.
|
||||
*/
|
||||
char* rotation_str = hdf_get_value( cgi->hdf, "Query.rotation", "" );
|
||||
double rotation = DEFAULT_ROTATION;
|
||||
double rotation = photo->default_rotation;
|
||||
if ( strlen( rotation_str ) )
|
||||
rotation = atof( rotation_str );
|
||||
if ( ( rotation < -360.0 ) || ( rotation > 360.0 ) )
|
||||
|
Loading…
Reference in New Issue
Block a user