Completed
Push — 0713 ( 6118f2 )
by Mikael
02:49
created

webroot/img_config.php (8 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Configuration for img.php, name the config file the same as your img.php and
4
 * append _config. If you are testing out some in imgtest.php then label that
5
 * config-file imgtest_config.php.
6
 *
7
 */
8
return array(
9
10
    /**
11
     * Set mode as 'strict', 'production' or 'development'.
12
     *
13
     * development: Development mode with verbose error reporting. Option
14
     *              &verbose and &status enabled.
15
     * production:  Production mode logs all errors to file, giving server
16
     *              error 500 for bad usage. Option &verbose and &status
17
     *              disabled.
18
     * strict:      Strict mode logs few errors to file, giving server error
19
     *              500 for bad usage. Stripped from comments and spaces.
20
     *              Option &verbose and &status disabled.
21
     *
22
     * Default values:
23
     *  mode: 'production'
24
     */
25
     //'mode' => 'production',
26
     'mode' => 'development',
27
     //'mode' => 'strict',
28
29
30
31
    /**
32
     * Where are the sources for the class files.
33
     *
34
     * Default values:
35
     *  autoloader:  null     // used from v0.6.2
36
     *  cimage_class: null    // used until v0.6.1
37
     */
38
    'autoloader'   =>  __DIR__ . '/../autoload.php',
39
    //'cimage_class' =>  __DIR__ . '/../CImage.php',
40
41
42
43
    /**
44
     * Paths, where are the images stored and where is the cache.
45
     * End all paths with a slash.
46
     *
47
     * Default values:
48
     *  image_path:     __DIR__ . '/img/'
49
     *  cache_path:     __DIR__ . '/../cache/'
50
     *  alias_path:     null
51
     */
52
    'image_path'        =>  __DIR__ . '/img/',
53
    'cache_path'        =>  __DIR__ . '/../cache/',
54
    //'alias_path'   =>  __DIR__ . '/img/alias/',
55
56
57
58
    /**
59
     * Fast track cache. Save a json representation of the image as a
60
     * fast track to the cached version of the image. This avoids some
61
     * processing and allows for quicker load times of cached images.
62
     *
63
     * Default values:
64
     *  fast_track_allow: false
65
     */
66
    'fast_track_allow' => true,
67
68
69
70
    /**
71
     * Class names to use, to ease dependency injection.
72
     *
73
     * Default values:
74
     *  CImage: CImage
75
     *  CCache: CCache
76
     *  CFastTrackCache: CFastTrackCache
77
     */
78
     //'CImage' => 'CImage',
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
79
     //'CCache' => 'CCache',
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
80
     //'CFastTrackCache' => 'CFastTrackCache',
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
81
82
83
84
    /**
85
     * Use password to protect from missusage, send &pwd=... or &password=..
86
     * with the request to match the password or set to false to disable.
87
     * Passwords are only used together with options for remote download
88
     * and aliasing.
89
     *
90
     * Create a passwords like this, depending on the type used:
91
     *  text: 'my_password'
92
     *  md5:  md5('my_password')
93
     *  hash: password_hash('my_password', PASSWORD_DEFAULT)
94
     *
95
     * Default values.
96
     *  password_always: false  // do not always require password,
97
     *  password:        false  // as in do not use password
98
     *  password_type:   'text' // use plain password, not encoded,
99
     */
100
    //'password_always' => false, // always require password,
101
    //'password'        => false, // "secret-password",
102
    //'password_type'   => 'text', // supports 'text', 'md5', 'hash',
103
104
105
106
    /**
107
     * Allow or disallow downloading of remote images available on
108
     * remote servers. Default is to disallow remote download.
109
     *
110
     * When enabling remote download, the default is to allow download any
111
     * link starting with http or https. This can be changed using
112
     * remote_pattern.
113
     *
114
     * When enabling remote_whitelist a check is made that the hostname of the
115
     * source to download matches the whitelist. By default the check is
116
     * disabled and thereby allowing download from any hosts.
117
     *
118
     * Default values.
119
     *  remote_allow:     false
120
     *  remote_pattern:   null  // use default values from CImage which is to
121
     *                          // allow download from any http- and
122
     *                          // https-source.
123
     *  remote_whitelist: null  // use default values from CImage which is to
124
     *                          // allow download from any hosts.
125
     */
126
    //'remote_allow'     => true,
127
    //'remote_pattern'   => '#^https?://#',
128
    //'remote_whitelist' => array(
129
    //    '\.facebook\.com$',
130
    //    '^(?:images|photos-[a-z])\.ak\.instagram\.com$',
131
    //    '\.google\.com$'
132
    //),
133
134
135
136
    /**
137
     * Use backup image if src-image is not found on disk. The backup image
138
     * is only available for local images and based on wether the original
139
     * image is found on disk or not. The backup image must be a local image
140
     * or the dummy image.
141
     *
142
     * Default value:
143
     *  src_alt:  null //disabled by default
144
     */
145
     //'src_alt' => 'car.png',
146
     //'src_alt' => 'dummy',
147
148
149
150
    /**
151
     * A regexp for validating characters in the image or alias filename.
152
     *
153
     * Default value:
154
     *  valid_filename:  '#^[a-z0-9A-Z-/_ \.:]+$#'
155
     *  valid_aliasname: '#^[a-z0-9A-Z-_]+$#'
156
     */
157
     //'valid_filename'  => '#^[a-z0-9A-Z-/_ \.:]+$#',
158
     //'valid_aliasname' => '#^[a-z0-9A-Z-_]+$#',
159
160
161
162
     /**
163
      * Change the default values for CImage quality and compression used
164
      * when saving images.
165
      *
166
      * Default value:
167
      *  jpg_quality:     null, integer between 0-100
168
      *  png_compression: null, integer between 0-9
169
      */
170
      //'jpg_quality'  => 75,
171
      //'png_compression' => 1,
172
173
174
175
      /**
176
       * Convert the image to srgb before processing. Saves the converted
177
       * image in a cache subdir 'srgb'. This option is default false but can
178
       * be changed to default true to do this conversion for all images.
179
       * This option requires PHP extension imagick and will silently fail
180
       * if that is not installed.
181
       *
182
       * Default value:
183
       *  srgb_default:      false
184
       *  srgb_colorprofile: __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc'
185
       */
186
       //'srgb_default' => false,
187
       //'srgb_colorprofile' => __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc',
188
189
190
191
       /**
192
        * Set skip-original to true to always process the image and use
193
        * the cached version. Default is false and to use the original
194
        * image when its no processing needed.
195
        *
196
        * Default value:
197
        *  skip_original: false
198
        */
199
        //'skip_original' => true,
200
201
202
203
      /**
204
       * A function (hook) can be called after img.php has processed all
205
       * configuration options and before processing the image using CImage.
206
       * The function receives the $img variabel and an array with the
207
       * majority of current settings.
208
       *
209
       * Default value:
210
       *  hook_before_CImage:     null
211
       */
212
       /*'hook_before_CImage' => function (CImage $img, Array $allConfig) {
213
           if ($allConfig['newWidth'] > 10) {
214
               $allConfig['newWidth'] *= 2;
215
           }
216
           return $allConfig;
217
       },*/
218
219
220
221
       /**
222
        * Add header for cache control when outputting images.
223
        *
224
        * Default value:
225
        *  cache_control: null, or set to string
226
        */
227
        //'cache_control' => "max-age=86400",
228
229
230
231
     /**
232
      * The name representing a dummy image which is automatically created
233
      * and stored as a image in the dir CACHE_PATH/dummy. The dummy image
234
      * can then be used as a placeholder image.
235
      * The dir CACHE_PATH/dummy is automatically created when needed.
236
      * Write protect the CACHE_PATH/dummy to prevent creation of new
237
      * dummy images, but continue to use the existing ones.
238
      *
239
      * Default value:
240
      *  dummy_enabled:  true as default, disable dummy feature by setting
241
      *                  to false.
242
      *  dummy_filename: 'dummy' use this as ?src=dummy to create a dummy image.
243
      */
244
      //'dummy_enabled' => true,
245
      //'dummy_filename' => 'dummy',
246
247
248
249
     /**
250
     * Check that the imagefile is a file below 'image_path' using realpath().
251
     * Security constraint to avoid reaching images outside image_path.
252
     * This means that symbolic links to images outside the image_path will
253
     * fail.
254
     *
255
     * Default value:
256
     *  image_path_constraint: true
257
     */
258
     //'image_path_constraint' => false,
259
260
261
262
     /**
263
     * Set default timezone.
264
     *
265
     * Default values.
266
     *  default_timezone: ini_get('default_timezone') or 'UTC'
267
     */
268
    //'default_timezone' => 'UTC',
269
270
271
272
    /**
273
     * Max image dimensions, larger dimensions results in 404.
274
     * This is basically a security constraint to avoid using resources on creating
275
     * large (unwanted) images.
276
     *
277
     * Default values.
278
     *  max_width:  2000
279
     *  max_height: 2000
280
     */
281
    //'max_width'     => 2000,
282
    //'max_height'    => 2000,
283
284
285
286
    /**
287
     * Set default background color for all images. Override it using
288
     * option bgColor.
289
     * Colorvalue is 6 digit hex string between 000000-FFFFFF
290
     * or 8 digit hex string if using the alpha channel where
291
     * the alpha value is between 00 (opaqe) and 7F (transparent),
292
     * that is between 00000000-FFFFFF7F.
293
     *
294
     * Default values.
295
     *  background_color: As specified by CImage
296
     */
297
    //'background_color' => "FFFFFF",
298
    //'background_color' => "FFFFFF7F",
299
300
301
302
    /**
303
     * Post processing of images using external tools, set to true or false
304
     * and set command to be executed.
305
     *
306
     * Default values.
307
     *
308
     *  png_filter:        false
309
     *  png_filter_cmd:    '/usr/local/bin/optipng -q'
310
     *
311
     *  png_deflate:       false
312
     *  png_deflate_cmd:   '/usr/local/bin/pngout -q'
313
     *
314
     *  jpeg_optimize:     false
315
     *  jpeg_optimize_cmd: '/usr/local/bin/jpegtran -copy none -optimize'
316
     */
317
    /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
49% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
318
    'postprocessing' => array(
319
        'png_filter'        => false,
320
        'png_filter_cmd'    => '/usr/local/bin/optipng -q',
321
322
        'png_deflate'       => false,
323
        'png_deflate_cmd'   => '/usr/local/bin/pngout -q',
324
325
        'jpeg_optimize'     => false,
326
        'jpeg_optimize_cmd' => '/usr/local/bin/jpegtran -copy none -optimize',
327
    ),
328
    */
329
330
331
332
    /**
333
     * Create custom convolution expressions, matrix 3x3, divisor and
334
     * offset.
335
     *
336
     * Default values.
337
     *  convolution_constant: array()
338
     */
339
    /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
55% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
340
    'convolution_constant' => array(
341
        //'sharpen'       => '-1,-1,-1, -1,16,-1, -1,-1,-1, 8, 0',
342
        //'sharpen-alt'   => '0,-1,0, -1,5,-1, 0,-1,0, 1, 0',
343
    ),
344
    */
345
346
347
348
    /**
349
     * Prevent leeching of images by controlling the hostname of those who
350
     * can access the images. Default is to allow hotlinking.
351
     *
352
     * Password apply when hotlinking is disallowed, use password to allow
353
     * hotlinking.
354
     *
355
     * The whitelist is an array of regexpes for allowed hostnames that can
356
     * hotlink images.
357
     *
358
     * Default values.
359
     *  allow_hotlinking:     true
360
     *  hotlinking_whitelist: array()
361
     */
362
     /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
363
    'allow_hotlinking' => false,
364
    'hotlinking_whitelist' => array(
365
        '^dbwebb\.se$',
366
    ),
367
    */
368
369
370
    /**
371
     * Create custom shortcuts for more advanced expressions.
372
     *
373
     * Default values.
374
     *  shortcut: array(
375
     *      'sepia' => "&f=grayscale&f0=brightness,-10&f1=contrast,-20&f2=colorize,120,60,0,0&sharpen",
376
     *  )
377
     */
378
     /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
53% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
379
    'shortcut' => array(
380
        'sepia' => "&f=grayscale&f0=brightness,-10&f1=contrast,-20&f2=colorize,120,60,0,0&sharpen",
381
    ),*/
382
383
384
385
    /**
386
     * Predefined size constants.
387
     *
388
     * These can be used together with &width or &height to create a constant value
389
     * for a width or height where can be changed in one place.
390
     * Useful when your site changes its layout or if you have a grid to fit images into.
391
     *
392
     * Example:
393
     *  &width=w1  // results in width=613
394
     *  &width=c2  // results in spanning two columns with a gutter, 30*2+10=70
395
     *  &width=c24 // results in spanning whole grid 24*30+((24-1)*10)=950
396
     *
397
     * Default values.
398
     *  size_constant: As specified by the function below.
399
     */
400
    /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
37% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
401
    'size_constant' => function () {
402
403
        // Set sizes to map constant to value, easier to use with width or height
404
        $sizes = array(
405
          'w1' => 613,
406
          'w2' => 630,
407
        );
408
409
        // Add grid column width, useful for use as predefined size for width (or height).
410
        $gridColumnWidth = 30;
411
        $gridGutterWidth = 10;
412
        $gridColumns     = 24;
413
414
        for ($i = 1; $i <= $gridColumns; $i++) {
415
            $sizes['c' . $i] = ($gridColumnWidth + $gridGutterWidth) * $i - $gridGutterWidth;
416
        }
417
418
        return $sizes;
419
    },*/
420
421
422
423
    /**
424
     * Predefined aspect ratios.
425
     *
426
     * Default values.
427
     *  aspect_ratio_constant: As the function below.
428
     */
429
    /*'aspect_ratio_constant' => function () {
430
        return array(
431
            '3:1'   => 3/1,
432
            '3:2'   => 3/2,
433
            '4:3'   => 4/3,
434
            '8:5'   => 8/5,
435
            '16:10' => 16/10,
436
            '16:9'  => 16/9,
437
            'golden' => 1.618,
438
        );
439
    },*/
440
441
442
443
    /**
444
     * Default options for ascii image.
445
     *
446
     * Default values as specified below in the array.
447
     *  ascii-options:
448
     *   characterSet:       Choose any character set available in CAsciiArt.
449
     *   scale:              How many pixels should each character
450
     *                       translate to.
451
     *   luminanceStrategy:  Choose any strategy available in CAsciiArt.
452
     *   customCharacterSet: Define your own character set.
453
     */
454
    /*'ascii-options' => array(
455
            "characterSet" => 'two',
456
            "scale" => 14,
457
            "luminanceStrategy" => 3,
458
            "customCharacterSet" => null,
459
        );
460
    },*/
461
);
462