72 static int getVerbosity(){
73 int loglevel = VERBOSITY;
74 const char *envpara = getenv(
"VERBOSITY" );
76 loglevel = atoi( envpara );
78 if( loglevel < 0 ) loglevel = 0;
84 static std::string getLogFile(){
85 const char* envpara = getenv(
"LOGFILE" );
86 if( envpara )
return std::string( envpara );
91 static float getMaxImageCacheSize(){
92 float max_image_cache_size = MAX_IMAGE_CACHE_SIZE;
93 const char* envpara = getenv(
"MAX_IMAGE_CACHE_SIZE" );
95 max_image_cache_size = atof( envpara );
97 return max_image_cache_size;
101 static long getMaxMetadataCacheSize(){
102 long max_metadata_cache_size = MAX_METADATA_CACHE_SIZE;
103 const char* envpara = getenv(
"MAX_METADATA_CACHE_SIZE" );
105 max_metadata_cache_size = atol( envpara );
107 return max_metadata_cache_size;
111 static std::string getFileNamePattern(){
112 const char* envpara = getenv(
"FILENAME_PATTERN" );
113 std::string filename_pattern;
115 filename_pattern = std::string( envpara );
117 else filename_pattern = FILENAME_PATTERN;
119 return filename_pattern;
123 static int getJPEGQuality(){
124 const char* envpara = getenv(
"JPEG_QUALITY" );
127 jpeg_quality = atoi( envpara );
128 if( jpeg_quality > 100 ) jpeg_quality = 100;
129 if( jpeg_quality < 1 ) jpeg_quality = 1;
131 else jpeg_quality = JPEG_QUALITY;
137 static int getPNGQuality(){
138 const char* envpara = getenv(
"PNG_QUALITY" );
141 quality = atoi( envpara );
142 if( quality > 9 ) quality = 9;
143 if( quality < 0 ) quality = 0;
145 else quality = PNG_QUALITY;
151 static int getWebPQuality(){
152 const char* envpara = getenv(
"WEBP_QUALITY" );
155 quality = atoi( envpara );
156 if( quality > 100 ) quality = 100;
157 if( quality < -1 ) quality = -1;
159 else quality = WEBP_QUALITY;
165 static int getAVIFQuality(){
166 const char* envpara = getenv(
"AVIF_QUALITY" );
169 quality = atoi( envpara );
170 if( quality > 100 ) quality = 100;
171 if( quality < -1 ) quality = -1;
173 else quality = AVIF_QUALITY;
181 const char* envpara = getenv(
"TIFF_COMPRESSION" );
184 compression = atoi( envpara );
185 if( compression < 0 || compression > 4 ) compression = 0;
187 else compression = TIFF_COMPRESSION;
193 static int getTIFFQuality(){
194 const char* envpara = getenv(
"TIFF_QUALITY" );
197 quality = atoi( envpara );
198 if( quality < 0 ) quality = 0;
199 if( quality > 100 ) quality = 100;
201 else quality = TIFF_QUALITY;
207 static unsigned int getAVIFCodec(){
209 const char* envpara = getenv(
"AVIF_CODEC" );
211 codec = atoi( envpara );
212 if( codec > 3 ) codec = 0;
214 else codec = AVIF_CODEC;
219 static int getMaxCVT(){
220 const char* envpara = getenv(
"MAX_CVT" );
223 max_CVT = atoi( envpara );
225 if( max_CVT < -1 ) max_CVT = 1;
227 else if( max_CVT == 0 ) max_CVT = MAX_CVT;
229 else max_CVT = MAX_CVT;
235 static int getMaxLayers(){
236 const char* envpara = getenv(
"MAX_LAYERS" );
238 if( envpara ) layers = atoi( envpara );
239 else layers = MAX_LAYERS;
245 static std::string getFileSystemPrefix(){
246 const char* envpara = getenv(
"FILESYSTEM_PREFIX" );
247 std::string filesystem_prefix;
249 filesystem_prefix = std::string( envpara );
251 else filesystem_prefix = FILESYSTEM_PREFIX;
252 return filesystem_prefix;
256 static std::string getFileSystemSuffix(){
257 const char* envpara = getenv(
"FILESYSTEM_SUFFIX" );
258 std::string filesystem_suffix;
260 filesystem_suffix = std::string( envpara );
262 else filesystem_suffix = FILESYSTEM_SUFFIX;
264 return filesystem_suffix;
268 static std::string getWatermark(){
269 const char* envpara = getenv(
"WATERMARK" );
270 std::string watermark;
272 watermark = std::string( envpara );
274 else watermark = WATERMARK;
280 static float getWatermarkProbability(){
281 float watermark_probability = WATERMARK_PROBABILITY;
282 const char* envpara = getenv(
"WATERMARK_PROBABILITY" );
285 watermark_probability = atof( envpara );
286 if( watermark_probability > 1.0 ) watermark_probability = 1.0;
287 if( watermark_probability < 0 ) watermark_probability = 0.0;
290 return watermark_probability;
294 static float getWatermarkOpacity(){
295 float watermark_opacity = WATERMARK_OPACITY;
296 const char* envpara = getenv(
"WATERMARK_OPACITY" );
299 watermark_opacity = atof( envpara );
300 if( watermark_opacity > 1.0 ) watermark_opacity = 1.0;
301 if( watermark_opacity < 0 ) watermark_opacity = 0.0;
304 return watermark_opacity;
308 static std::string getMemcachedServers(){
309 const char* envpara = getenv(
"MEMCACHED_SERVERS" );
310 std::string memcached_servers;
312 memcached_servers = std::string( envpara );
314 else memcached_servers = LIBMEMCACHED_SERVERS;
316 return memcached_servers;
320 static unsigned int getMemcachedTimeout(){
321 const char* envpara = getenv(
"MEMCACHED_TIMEOUT" );
322 unsigned int memcached_timeout;
323 if( envpara ) memcached_timeout = atoi( envpara );
324 else memcached_timeout = LIBMEMCACHED_TIMEOUT;
326 return memcached_timeout;
330 static unsigned int getInterpolation(){
331 const char* envpara = getenv(
"INTERPOLATION" );
332 unsigned int interpolation;
333 if( envpara ) interpolation = atoi( envpara );
334 else interpolation = INTERPOLATION;
336 return interpolation;
340 static std::string getCORS(){
341 const char* envpara = getenv(
"CORS" );
343 if( envpara ) cors = std::string( envpara );
349 static std::string getBaseURL(){
350 const char* envpara = getenv(
"BASE_URL" );
351 std::string base_url;
352 if( envpara ) base_url = std::string( envpara );
353 else base_url = BASE_URL;
358 static std::string getCacheControl(){
359 const char* envpara = getenv(
"CACHE_CONTROL" );
360 std::string cache_control;
361 if( envpara ) cache_control = std::string( envpara );
362 else cache_control = CACHE_CONTROL;
363 return cache_control;
367 static bool getAllowUpscaling(){
368 const char* envpara = getenv(
"ALLOW_UPSCALING" );
369 bool allow_upscaling;
370 if( envpara ) allow_upscaling = atoi( envpara );
371 else allow_upscaling = ALLOW_UPSCALING;
372 return allow_upscaling;
376 static std::string getURIMap(){
377 const char* envpara = getenv(
"URI_MAP" );
379 if( envpara ) uri_map = std::string( envpara );
380 else uri_map = URI_MAP;
385 static int getMaxICC(){
386 const char* envpara = getenv(
"MAX_ICC" );
389 max_icc = atoi( envpara );
391 else max_icc = MAX_ICC;
396 static bool getCodecPassthrough(){
397 const char* envpara = getenv(
"CODEC_PASSTHROUGH" );
398 bool codec_passthrough;
399 if( envpara ) codec_passthrough = atoi( envpara );
400 else codec_passthrough = CODEC_PASSTHROUGH;
401 return codec_passthrough;
405 static unsigned int getKduReadMode(){
406 unsigned int readmode;
407 const char* envpara = getenv(
"KAKADU_READMODE" );
409 readmode = atoi( envpara );
410 if( readmode > 2 ) readmode = 2;
412 else readmode = KAKADU_READMODE;
417 static unsigned int getIIIFVersion(){
418 unsigned int version;
419 const char* envpara = getenv(
"IIIF_VERSION" );
421 version = atoi( envpara );
422 if( version < 1 ) version = IIIF_VERSION;
424 else version = IIIF_VERSION;
429 static std::string getIIIFDelimiter(){
430 const char* envpara = getenv(
"IIIF_DELIMITER" );
431 if( envpara )
return std::string( envpara );
432 else return IIIF_DELIMITER;
436 static std::string getIIIFExtraInfo(){
437 const char* envpara = getenv(
"IIIF_EXTRA_INFO" );
438 if( envpara )
return std::string( envpara );
439 else return IIIF_EXTRA_INFO;
443 static bool getIIIFExtensions(){
444 const char* envpara = getenv(
"IIIF_EXTENSIONS" );
446 if( envpara ) extensions = atoi( envpara );
447 else extensions = IIIF_EXTENSIONS;
452 static std::string getCopyright(){
453 const char* envpara = getenv(
"COPYRIGHT" );
454 if( envpara )
return std::string( envpara );
455 else return COPYRIGHT;