Completed
Push — 079 ( c009f4...b069e3 )
by Mikael
04:32
created

webroot/img_config.php (3 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
     * Default values:
14
     *  mode: 'production'
15
     */
16
     //'mode' => 'production',
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...
17
     //'mode' => 'development',
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...
18
     //'mode' => 'strict',
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...
19
20
21
22
    /**
23
     * Where are the sources for the classfiles.
24
     *
25
     * Default values:
26
     *  autoloader:  null     // used from v0.6.2
27
     *  cimage_class: null    // used until v0.6.1
28
     */
29
    'autoloader'   =>  __DIR__ . '/../autoload.php',
30
    //'cimage_class' =>  __DIR__ . '/../CImage.php',
31
32
33
34
    /**
35
     * Paths, where are the images stored and where is the cache.
36
     * End all paths with a slash.
37
     *
38
     * Default values:
39
     *  image_path: __DIR__ . '/img/'
40
     *  cache_path: __DIR__ . '/../cache/'
41
     *  alias_path: null
42
     */
43
    'image_path'   =>  __DIR__ . '/img/',
44
    'cache_path'   =>  __DIR__ . '/../cache/',
45
    //'alias_path'   =>  __DIR__ . '/img/alias/',
46
47
48
49
    /**
50
     * Use password to protect from missusage, send &pwd=... or &password=..
51
     * with the request to match the password or set to false to disable.
52
     * Passwords are only used together with options for remote download
53
     * and aliasing.
54
     *
55
     * Create a passwords like this, depending on the type used:
56
     *  text: 'my_password'
57
     *  md5:  md5('my_password')
58
     *  hash: password_hash('my_password', PASSWORD_DEFAULT)
59
     *
60
     * Default values.
61
     *  password_always: false  // do not always require password,
62
     *  password:        false  // as in do not use password
63
     *  password_type:   'text' // use plain password, not encoded,
64
     */
65
    //'password_always' => false, // always require password,
66
    //'password'        => false, // "secret-password",
67
    //'password_type'   => 'text', // supports 'text', 'md5', 'hash',
68
69
70
71
    /**
72
     * Allow or disallow downloading of remote images available on
73
     * remote servers. Default is to disallow remote download.
74
     *
75
     * When enabling remote download, the default is to allow download any
76
     * link starting with http or https. This can be changed using
77
     * remote_pattern.
78
     *
79
     * When enabling remote_whitelist a check is made that the hostname of the
80
     * source to download matches the whitelist. By default the check is
81
     * disabled and thereby allowing download from any hosts.
82
     *
83
     * Default values.
84
     *  remote_allow:     false
85
     *  remote_pattern:   null  // use default values from CImage which is to
86
     *                          // allow download from any http- and
87
     *                          // https-source.
88
     *  remote_whitelist: null  // use default values from CImage which is to
89
     *                          // allow download from any hosts.
90
     */
91
    //'remote_allow'     => true,
92
    //'remote_pattern'   => '#^https?://#',
93
    //'remote_whitelist' => array(
94
    //    '\.facebook\.com$',
95
    //    '^(?:images|photos-[a-z])\.ak\.instagram\.com$',
96
    //    '\.google\.com$'
97
    //),
98
99
100
101
    /**
102
     * A regexp for validating characters in the image or alias filename.
103
     *
104
     * Default value:
105
     *  valid_filename:  '#^[a-z0-9A-Z-/_ \.:]+$#'
106
     *  valid_aliasname: '#^[a-z0-9A-Z-_]+$#'
107
     */
108
     //'valid_filename'  => '#^[a-z0-9A-Z-/_ \.:]+$#',
109
     //'valid_aliasname' => '#^[a-z0-9A-Z-_]+$#',
110
111
112
113
     /**
114
      * Change the default values for CImage quality and compression used
115
      * when saving images.
116
      *
117
      * Default value:
118
      *  jpg_quality:     null, integer between 0-100
119
      *  png_compression: null, integer between 0-9
120
      */
121
      //'jpg_quality'  => 75,
122
      //'png_compression' => 1,
123
124
125
126
      /**
127
       * Convert the image to srgb before processing. Saves the converted
128
       * image in a cache subdir 'srgb'. This option is default false but can
129
       * be changed to default true to do this conversion for all images.
130
       * This option requires PHP extension imagick and will silently fail
131
       * if that is not installed.
132
       *
133
       * Default value:
134
       *  srgb_default:      false
135
       *  srgb_colorprofile: __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc'
136
       */
137
       //'srgb_default' => false,
138
       //'srgb_colorprofile' => __DIR__ . '/../icc/sRGB_IEC61966-2-1_black_scaled.icc',
139
140
141
142
      /**
143
       * A function (hook) can be called after img.php has processed all
144
       * configuration options and before processing the image using CImage.
145
       * The function receives the $img variabel and an array with the
146
       * majority of current settings.
147
       *
148
       * Default value:
149
       *  hook_before_CImage:     null
150
       */
151
       /*'hook_before_CImage' => function (CImage $img, Array $allConfig) {
152
           if ($allConfig['newWidth'] > 10) {
153
               $allConfig['newWidth'] *= 2;
154
           }
155
           return $allConfig;
156
       },*/
157
158
159
160
       /**
161
        * Add header for cache control when outputting images.
162
        *
163
        * Default value:
164
        *  cache_control: null, or set to string
165
        */
166
        //'cache_control' => "max-age=86400",
167
168
169
170
     /**
171
      * The name representing a dummy image which is automatically created
172
      * and stored as a image in the dir CACHE_PATH/dummy. The dummy image
173
      * can then be used as a placeholder image.
174
      * The dir CACHE_PATH/dummy is automatically created when needed.
175
      * Write protect the CACHE_PATH/dummy to prevent creation of new
176
      * dummy images, but continue to use the existing ones.
177
      *
178
      * Default value:
179
      *  dummy_enabled:  true as default, disable dummy feature by setting
180
      *                  to false.
181
      *  dummy_filename: 'dummy' use this as ?src=dummy to create a dummy image.
182
      */
183
      //'dummy_enabled' => true,
184
      //'dummy_filename' => 'dummy',
185
186
187
188
     /**
189
     * Check that the imagefile is a file below 'image_path' using realpath().
190
     * Security constraint to avoid reaching images outside image_path.
191
     * This means that symbolic links to images outside the image_path will fail.
192
     *
193
     * Default value:
194
     *  image_path_constraint: true
195
     */
196
     //'image_path_constraint' => false,
197
198
199
200
     /**
201
     * Set default timezone.
202
     *
203
     * Default values.
204
     *  default_timezone: ini_get('default_timezone') or 'UTC'
205
     */
206
    //'default_timezone' => 'UTC',
207
208
209
210
    /**
211
     * Max image dimensions, larger dimensions results in 404.
212
     * This is basically a security constraint to avoid using resources on creating
213
     * large (unwanted) images.
214
     *
215
     * Default values.
216
     *  max_width:  2000
217
     *  max_height: 2000
218
     */
219
    //'max_width'     => 2000,
220
    //'max_height'    => 2000,
221
222
223
224
    /**
225
     * Set default background color for all images. Override it using
226
     * option bgColor.
227
     * Colorvalue is 6 digit hex string between 000000-FFFFFF
228
     * or 8 digit hex string if using the alpha channel where
229
     * the alpha value is between 00 (opaqe) and 7F (transparent),
230
     * that is between 00000000-FFFFFF7F.
231
     *
232
     * Default values.
233
     *  background_color: As specified by CImage
234
     */
235
    //'background_color' => "FFFFFF",
236
    //'background_color' => "FFFFFF7F",
237
238
239
240
    /**
241
     * Post processing of images using external tools, set to true or false
242
     * and set command to be executed.
243
     *
244
     * Default values.
245
     *
246
     *  png_filter:        false
247
     *  png_filter_cmd:    '/usr/local/bin/optipng -q'
248
     *
249
     *  png_deflate:       false
250
     *  png_deflate_cmd:   '/usr/local/bin/pngout -q'
251
     *
252
     *  jpeg_optimize:     false
253
     *  jpeg_optimize_cmd: '/usr/local/bin/jpegtran -copy none -optimize'
254
     */
255
    /*
256
    'postprocessing' => array(
257
        'png_filter'        => false,
258
        'png_filter_cmd'    => '/usr/local/bin/optipng -q',
259
260
        'png_deflate'       => false,
261
        'png_deflate_cmd'   => '/usr/local/bin/pngout -q',
262
263
        'jpeg_optimize'     => false,
264
        'jpeg_optimize_cmd' => '/usr/local/bin/jpegtran -copy none -optimize',
265
    ),
266
    */
267
268
269
270
    /**
271
     * Create custom convolution expressions, matrix 3x3, divisor and
272
     * offset.
273
     *
274
     * Default values.
275
     *  convolution_constant: array()
276
     */
277
    /*
278
    'convolution_constant' => array(
279
        //'sharpen'       => '-1,-1,-1, -1,16,-1, -1,-1,-1, 8, 0',
280
        //'sharpen-alt'   => '0,-1,0, -1,5,-1, 0,-1,0, 1, 0',
281
    ),
282
    */
283
284
285
286
    /**
287
     * Prevent leeching of images by controlling the hostname of those who
288
     * can access the images. Default is to allow hotlinking.
289
     *
290
     * Password apply when hotlinking is disallowed, use password to allow
291
     * hotlinking.
292
     *
293
     * The whitelist is an array of regexpes for allowed hostnames that can
294
     * hotlink images.
295
     *
296
     * Default values.
297
     *  allow_hotlinking:     true
298
     *  hotlinking_whitelist: array()
299
     */
300
     /*
301
    'allow_hotlinking' => false,
302
    'hotlinking_whitelist' => array(
303
        '^dbwebb\.se$',
304
    ),
305
    */
306
307
308
    /**
309
     * Create custom shortcuts for more advanced expressions.
310
     *
311
     * Default values.
312
     *  shortcut: array(
313
     *      'sepia' => "&f=grayscale&f0=brightness,-10&f1=contrast,-20&f2=colorize,120,60,0,0&sharpen",
314
     *  )
315
     */
316
     /*
317
    'shortcut' => array(
318
        'sepia' => "&f=grayscale&f0=brightness,-10&f1=contrast,-20&f2=colorize,120,60,0,0&sharpen",
319
    ),*/
320
321
322
323
    /**
324
     * Predefined size constants.
325
     *
326
     * These can be used together with &width or &height to create a constant value
327
     * for a width or height where can be changed in one place.
328
     * Useful when your site changes its layout or if you have a grid to fit images into.
329
     *
330
     * Example:
331
     *  &width=w1  // results in width=613
332
     *  &width=c2  // results in spanning two columns with a gutter, 30*2+10=70
333
     *  &width=c24 // results in spanning whole grid 24*30+((24-1)*10)=950
334
     *
335
     * Default values.
336
     *  size_constant: As specified by the function below.
337
     */
338
    /*
339
    'size_constant' => function () {
340
341
        // Set sizes to map constant to value, easier to use with width or height
342
        $sizes = array(
343
          'w1' => 613,
344
          'w2' => 630,
345
        );
346
347
        // Add grid column width, useful for use as predefined size for width (or height).
348
        $gridColumnWidth = 30;
349
        $gridGutterWidth = 10;
350
        $gridColumns     = 24;
351
352
        for ($i = 1; $i <= $gridColumns; $i++) {
353
            $sizes['c' . $i] = ($gridColumnWidth + $gridGutterWidth) * $i - $gridGutterWidth;
354
        }
355
356
        return $sizes;
357
    },*/
358
359
360
361
    /**
362
     * Predefined aspect ratios.
363
     *
364
     * Default values.
365
     *  aspect_ratio_constant: As the function below.
366
     */
367
    /*'aspect_ratio_constant' => function () {
368
        return array(
369
            '3:1'   => 3/1,
370
            '3:2'   => 3/2,
371
            '4:3'   => 4/3,
372
            '8:5'   => 8/5,
373
            '16:10' => 16/10,
374
            '16:9'  => 16/9,
375
            'golden' => 1.618,
376
        );
377
    },*/
378
379
380
381
    /**
382
     * default options for ascii image.
383
     *
384
     * Default values as specified below in the array.
385
     *  ascii-options:
386
     *   characterSet:       Choose any character set available in CAsciiArt.
387
     *   scale:              How many pixels should each character
388
     *                       translate to.
389
     *   luminanceStrategy:  Choose any strategy available in CAsciiArt.
390
     *   customCharacterSet: Define your own character set.
391
     */
392
    /*'ascii-options' => array(
393
            "characterSet" => 'two',
394
            "scale" => 14,
395
            "luminanceStrategy" => 3,
396
            "customCharacterSet" => null,
397
        );
398
    },*/
399
);
400