/
config.php
1973 lines (1826 loc) · 66.3 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php namespace ProcessWire;
/**
* ProcessWire Configuration File
*
* Configuration options for ProcessWire
*
* To override any of these options, copy the option you want to modify to
* /site/config.php and adjust as you see fit. Options in /site/config.php
* override those in this file.
*
* You may also make up your own configuration options by assigning them
* in /site/config.php
*
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
* https://processwire.com
*
*
* TABLE OF CONTENTS
* ===============================
* 1. System modes
* 2. Dates and times
* 3. Session
* 4. Template files
* 5. Files and assets
* 6. HTTP and input
* 7. Database
* 8. Modules
* 9. Misc
* 10. Runtime
* 11. System
*
* @var Config $config
*
*/
if(!defined("PROCESSWIRE")) die();
/*** 1. SYSTEM MODES ****************************************************************************/
/**
* Enable debug mode?
*
* Debug mode causes additional info to appear for use during site development and debugging.
* This is almost always recommended for sites in development. However, you should
* always have this disabled for live/production sites since it reveals more information
* than is advisible for security.
*
* You may also set this to the constant `Config::debugVerbose` to enable verbose debug mode,
* which uses more memory and time.
*
* #notes This enables debug mode for ALL requests. See the debugIf option for an alternative.
*
* @var bool
*
*/
$config->debug = false;
/**
* Enable debug mode if condition is met
*
* Set debug mode to be false above, and then specify any one of the following here:
* 1) IP address of user required to enable debug mode;
* 2) Your own callable function name (i.e. "debug_mode") in /site/config.php that returns
* true or false for debug mode;
* 3) PCRE regular expression to match IP address of user (must start and end with a "/"
* slash). If IP address matches, then debug mode is enabled. Regular expression
* example: /^123\.456\.789\./ would match all IP addresses that started with 123.456.789.
*
* #notes When used, this overrides $config->debug, changing it at runtime automatically.
* @var string
*
*/
$config->debugIf = '';
/**
* Tools, and their order, to show in debug mode (admin)
*
* Options include: pages, api, session, modules, hooks, database, db, timers, user, input, cache, autoload, lazyload
*
* Note: when used, lazyload option should be placed first beause its results can be affected by later debug tools.
*
* @var array
*
*/
$config->debugTools = array(
//'lazyload',
'pages',
'api',
'session',
'modules',
'hooks',
'database', // PDO
'db', // mysqli
'timers',
'user',
'input',
'cache',
'autoload',
);
/**
* Enable ProcessWire advanced development mode?
*
* Turns on additional options in ProcessWire Admin that aren't applicable in all instances.
* Be careful with this as some options configured in advanced mode (like system statuses)
* cannot be removed once set (at least not without going directly into the database). Below
* is a summary of what enabling advanced mode adds/changes:
*
* Fields (Setup > Fields):
*
* - Enables "system" and "permanent" flags as checkboxes on the Advanced tab when editing a field.
* - Makes the admin Setup > Fields dropdown show all fields, including system fields.
* - Enables creation of new fields using types only allowed in advanced mode.
* - Enables cloning of system fields.
* - Enables showing of System templates when selecting templates to add field to (Actions tab).
*
* Templates (Setup > Templates):
*
* - Makes the admin Setup > Templates dropdown show all templates, including system templates.
* - On the Basics tab, enables you to select a Fieldgroup independent of the Template.
* - Enables you to add "Permanent" flagged fields to a template.
* - When editing a template, makes it show a "System" tab with ability to assign system flag,
* predefined page class name, cancel of global status, setting to make the "name" field appear
* in the Content tab of the page editor, option to make page deletions bypass the trash, and
* option to disable the Settings tab in the page editor.
* - Enables you to copy fields from another Fieldgroup maintained by a system template.
* - Makes the "Advanced" tab show API examples with the Inputfield notes.
*
* Page Editor:
*
* - Enables showing of "Object type" Page class name on Settings tab Info fields.
* - Enables you to select System or SystemID status for a Page on the Settings tab Status field.
* - Enables some template changes for superuser that go beyond configured Family settings.
*
* Other:
*
* - In Modules, enables disable of autoload state for existing autoload module, for debug purposes.
* - In Lister, paired with debug mode, shows a fully parsed selector under the Lister table.
* - Shows an "Advanced mode" label in the footer of the admin theme.
*
* #notes Recommended mode is false, except occasionally during ProcessWire core or module development.
* @var bool
*
*/
$config->advanced = false;
/**
* Enable demo mode?
*
* If true, disables save functions in Process modules (admin).
*
* @var bool
*
*/
$config->demo = false;
/**
* Enable core API variables to be accessed as function calls?
*
* Benefits are better type hinting, always in scope, and potentially shorter API calls.
* See the file /wire/core/FunctionsAPI.php for details on these functions.
*
* @var bool
*
*/
$config->useFunctionsAPI = false;
/**
* Enable use of front-end markup regions?
*
* When enabled, HTML elements with an "id" attribute that are output before the opening
* `<!doctype>` or `<html>` tag can replace elements in the document that have the same id.
* Also supports append, prepend, replace, remove, before and after options.
*
* @var bool
*
*/
$config->useMarkupRegions = false;
/**
* Use custom page classes? Specify boolean true to enable.
*
* When enabled, if a class with name "[TemplateName]Page" (in ProcessWire namespace) exists
* in /site/classes/[TemplateName]Page.php, and it extends ProcessWire’s Page class, then the
* Page will be created with that class rather than the default Page class. For instance,
* template “home” would look for a class named “HomePage” and template "blog-post" (or
* "blog_post") would look for a class named “BlogPostPage” (file: BlogPostPage.php).
*
* If you create a file named /site/classes/DefaultPage.php with a DefaultPage class within
* it (that extends Page), then it will be used for all pages that would otherwise use the
* `Page` class.
*
* @var bool|string
* @since 3.0.152
*
*/
$config->usePageClasses = false;
/**
* Use lazy loading of fields (plus templates and fieldgroups) for faster boot times?
*
* This delays loading of fields, templates and fieldgroups until they are requested.
* This can improve performance on systems with hundreds of fields or templates, as
* individual fields, templates/fieldgroups won't get constructed until they are needed.
*
* Specify `true` to use lazy loading for all types, `false` to disable all lazy loading,
* or specify array with one or more of the following for lazy loading only certain types:
* `[ 'fields', 'templates', 'fieldgroups' ]`
*
* @var bool|array
* @since 3.0.194
*
*/
$config->useLazyLoading = true;
/**
* Disable all HTTPS requirements?
*
* Use this option only for development or staging environments, on sites where you are
* otherwise requiring HTTPS. By setting this option to something other than false, you
* can disable any HTTPS requirements specified per-template, enabling you to use your
* site without SSL during development or staging, etc.
*
* The following options are available:
* - boolean true: Disable HTTPS requirements globally
* - string containing hostname: Disable HTTPS requirements only for specified hostname.
* - array containing hostnames: Disable HTTPS requirements for specified hostnames.
*
* @var bool|string|array
*
*/
$config->noHTTPS = false;
/*** 2. DATES & TIMES *************************************************************************/
/**
* Default time zone
*
* Must be a [PHP timezone string](http://php.net/manual/en/timezones.php)
*
* #input timezone
* @var string
*
*/
$config->timezone = 'America/New_York';
/**
* System date format
*
* Default system date format. Preferably in a format that is string sortable.
*
* #notes This should be a [PHP date string](http://www.php.net/manual/en/function.date.php).
*
* @var string
*
*/
$config->dateFormat = 'Y-m-d H:i:s';
/*** 3. SESSION *********************************************************************************/
/**
* Session name
*
* Default session name as used in session cookie. You may wish to change this if running
* multiple ProcessWire installations on the same server. By giving each installation a unique
* session name, you can stay logged into multiple installations at once.
*
* #notes Note that changing this will automatically logout any current sessions.
* @var string
*
*/
$config->sessionName = 'wire';
/**
* Session name when on HTTPS
*
* Same as session name but when on HTTPS. This is only used when the sessionCookieSecure
* option is enabled (default). When blank (default), it will be sessionName + 's'.
*
* @var string
*
*/
$config->sessionNameSecure = '';
/**
* Session expiration seconds
*
* How many seconds of inactivity before session expires
*
* @var int
*
*/
$config->sessionExpireSeconds = 86400;
/**
* Are sessions allowed?
*
* Use this to determine at runtime whether or not a session is allowed for the current request.
* Otherwise, this should always be boolean TRUE. When using this option, we recommend
* providing a callable function like below. Make sure that you put in some logic to enable
* sessions on admin pages at minimum. The callable function receives a single $wire argument
* which is the ProcessWire instance.
*
* Note that the API is not fully ready when this function is called, so the current $page and
* the current $user are not yet known, nor is the $input API variable available.
*
* Also note that if anything in the request calls upon $session->CSRF, then a session is
* automatically enabled.
*
* ~~~~~
* $config->sessionAllow = function($session) use($config) {
*
* // if there is a session cookie, a session is likely already in use so keep it going
* if($session->hasCookie()) return true;
*
* // if URL is an admin URL, allow session (replace /processwire/ with your admin URL)
* if(strpos($config->requestPath(), '/processwire/') === 0) return true;
*
* // otherwise disallow session
* return false;
* };
* ~~~~~
*
* @var bool|callable Should be boolean, or callable that returns boolean.
*
*/
$config->sessionAllow = true;
/**
* Use session challenge?
*
* Should login sessions have a challenge key? (for extra security, recommended)
*
* @var bool
*
*/
$config->sessionChallenge = true;
/**
* Use session fingerprint?
*
* Should login sessions also be tied to a fingerprint of the browser?
* Fingerprinting can be based upon browser-specific headers and/or
* IP addresses. But note that IP fingerprinting will be problematic on
* dynamic IPs.
*
* Predefined settings:
*
* - 0 or false: Fingerprint off
* - 1 or true: Fingerprint on with default setting (remote IP & useragent)
*
* Custom settings:
*
* - 2: Remote IP
* - 4: Forwarded/client IP (can be spoofed)
* - 8: Useragent
* - 16: Accept header
*
* To use the custom settings above, select one or more of those you want
* to fingerprint, note the numbers, and use them like in the examples:
* ~~~~~~
* // to fingerprint just remote IP
* $config->sessionFingerprint = 2;
*
* // to fingerprint remote IP and useragent:
* $config->sessionFingerprint = 2 | 8;
*
* // to fingerprint remote IP, useragent and accept header:
* $config->sessionFingerprint = 2 | 8 | 16;
* ~~~~~~
*
* If using fingerprint in an environment where the user’s IP address may
* change during the session, you should fingerprint only the useragent
* and/or accept header, or disable fingerprinting.
*
* If using fingerprint with an AWS load balancer, you should use one of
* the options that uses the “client IP” rather than the “remote IP”,
* fingerprint only useragent and/or accept header, or disable fingerprinting.
*
* @var int
*
*/
$config->sessionFingerprint = 1;
/**
* Force current session IP address (overriding auto-detect)
*
* This overrides the return value of `$session->getIP()` method.
* Use this property only for setting the IP address. To get the IP address
* always use the `$session->getIP()` method instead.
*
* This is useful if you are in an environment where the remote IP address
* comes from some property other than the REMOTE_ADDR in $_SERVER. For instance,
* if you are using a load balancer, what’s usually detected as the IP address is
* actually the IP address between the load balancer and the server, rather than
* the client IP address. So in that case, you’d want to set this property as
* follows:
* ~~~~~
* $config->sessionForceIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
* ~~~~~
* If you don’t have a specific need to override the IP address of the user
* then you should leave this blank.
*
* @var string
*
*/
$config->sessionForceIP = '';
/**
* Use secure cookies when on HTTPS?
*
* When enabled, separate sessions will be maintained for
* HTTP vs. HTTPS. This ensures the session is secure on HTTPS.
* The tradeoff is that switching between HTTP and HTTPS means
* that you may be logged in on one and not the other.
*
* 0 or false: secure cookies off
* 1 or true: secure cookies on (default)
*
* @var int
*
*/
$config->sessionCookieSecure = 1;
/**
* Cookie domain for sessions
*
* Enables a session to traverse multiple subdomains.
* Specify a string having “.domain.com” (with leading period) or NULL to disable (default/recommended).
*
* @var string|null
*
*/
$config->sessionCookieDomain = null;
/**
* Cookie “SameSite” value for sessions - “Lax” (default) or “Strict”
*
* - `Lax`: The session cookie will be sent along with the GET requests initiated by third party website.
* This ensures an existing session on this site is maintained when clicking to it from another site.
*
* - `Strict`: The session cookie will not be sent along with requests initiated by third party websites.
* If user already has a login session on this site, it won’t be recognized when clicking from another
* site to this one.
*
* The default/recommended value is `Lax`.
*
* @var string
* @since 3.0.178
* @see https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite
*
*/
$config->sessionCookieSameSite = 'Lax';
/**
* Number of session history entries to record.
*
* When enabled (with a value > 0) a history of pageviews will be recorded in the
* session. These can be retrieved with $session->getHistory().
*
* @var int
*
*/
$config->sessionHistory = 0;
/**
* Hash method to use for passwords.
*
* Can be any available with your PHP's hash() installation. For instance, you may prefer
* to use something like sha256 if supported by your PHP installation.
*
* @deprecated Only here for backwards compatibility.
*
*/
$config->userAuthHashType = 'sha1';
/**
* Names (string) or IDs (int) of roles that are not allowed to login
*
* Note that you must create these roles yourself in the admin. When a user has
* one of these named roles, $session->login() will not accept a login from them.
* This affects the admin login form and any other login forms that use ProcessWire’s
* session system.
*
* The default value specifies a role name of "login-disabled", meaning if you create
* a role with that name, and assign it to a user, that user will no longer be able
* to login.
*
* @var array
*
*/
$config->loginDisabledRoles = array(
'login-disabled'
);
/*** 4. TEMPLATE FILES **************************************************************************/
/**
* Allow template files to be compiled?
*
* Set to false to disable the option for compiled template files.
* When set to true, it will be used unless a given template's 'compile' option is set to 0.
* This setting also covers system status files like /site/ready.php, /site/init.php, etc. (3.0.142+)
*
* @var bool
*
*/
$config->templateCompile = strlen(__NAMESPACE__) > 0;
/**
* Prepend template file
*
* PHP file in /site/templates/ that will be loaded before each page's template file.
*
* #notes Example: _init.php
* @var string
*
*/
$config->prependTemplateFile = '';
/**
* Append template file
*
* PHP file in /site/templates/ that will be loaded after each page's template file.
*
* #notes Example: _main.php
* @var string
*
*/
$config->appendTemplateFile = '';
/**
* Regular expression to ignore template files
*
* When checking for new template files, files matching this PCRE regex will be ignored.
*
* #notes The default setting of /^_/ ignores all files that begin with an underscore.
* @var string
*
*/
$config->ignoreTemplateFileRegex = '/^_/';
/**
* Expected extension for template files (we don't recommend changing this)
*
*/
$config->templateExtension = 'php';
/*** 5. FILES & ASSETS ************************************************************************/
/**
* Directory mode
*
* Octal string permissions assigned to directories created by ProcessWire.
* Please avoid 0777 if at all possible as that is too open for most installations.
* Note that changing this does not change permissions for existing directories,
* only newly created directories.
*
* #notes See [chmod man page](http://ss64.com/bash/chmod.html).
* #pattern /^0[0-9]{3}$/
* @var string
*
*/
$config->chmodDir = "0755";
/**
* File mode
*
* Octal string permissions assigned to files created by ProcessWire.
* Please avoid 0666 if at all possible as that is too open for most installations.
* Note that changing this does not change permissions for existing files, only newly
* created/uploaded files.
*
* #notes See [chmod man page](http://ss64.com/bash/chmod.html).
* #pattern /^0[0-9]{3}$/
* @var string
*
*/
$config->chmodFile = "0644";
/**
* Set this to false if you want to suppress warnings about 0666/0777 permissions that are too open
*
* @var bool
*
*/
$config->chmodWarn = true;
/**
* Bad file extensions for uploads
*
* File extensions that are always disallowed from uploads (each separated by a space).
*
* @var string
*
*/
$config->uploadBadExtensions = 'php php3 phtml exe cfm shtml asp pl cgi sh vbs jsp';
/**
* Secure page files?
*
* When, true, prevents http access to file assets of access protected pages.
*
* Set to true if you want files on non-public or unpublished pages to be
* protected from direct URL access.
*
* When used, such files will be delivered at a URL that is protected from public access.
*
* @var bool
*
*/
$config->pagefileSecure = false;
/**
* String that prefixes filenames in PW URLs, becoming a shortcut to a page's file's URL
*
* This must be at the end of the URL. For the prefix "-/", a files URL would look like this:
* /path/to/page/-/filename.jpg => same as: /site/assets/files/123/filename.jpg
*
* This should be a prefix that is not the same as any page name, as it takes precedence.
*
* This prefix is deprecated. Insert this into your /site/config.php as a temporary fix only if you
* have broken images from <img> tags placed in textarea fields.
*
* @deprecated
*
* $config->pagefileUrlPrefix = '-/';
*
*/
/**
* Prefix for secure page files
*
* One or more characters prefixed to the pathname of secured file dirs.
*
* If use of this feature originated with a pre-2.3 install, this may need to be
* specified as "." rather than "-".
*
*/
$config->pagefileSecurePathPrefix = '-';
/**
* Use extended file mapping?
*
* Enable this if you expect to have >30000 pages in your site.
*
* Set to true in /site/config.php if you want files to live in an extended path mapping system
* that limits the number of directories per path to under 2000.
*
* Use this on large sites living on file systems with hard limits on quantity of directories
* allowed per directory level. For example, ext2 and its 30000 directory limit.
*
* Please note that for existing sites, this applies only for new pages created from this
* point forward.
*
* #notes Warning: The extended file mapping feature is not yet widely tested, so consider it beta.
* @var bool
*
*/
$config->pagefileExtendedPaths = false;
/**
* Allowed content types for output by template files
*
* When one of these options is selected for a template, the header will be sent
* automatically regardless of whether request is live or cached.
*
* The keys of the array are file extensions. They are used for identification
* and storage purposes. In ProCache, they are used as a file extension which
* connects a configured Apache MIME type to the appropriate content type header.
*
* @var array
*
*/
$config->contentTypes = array(
'html' => 'text/html',
'txt' => 'text/plain',
'json' => 'application/json',
'xml' => 'application/xml',
);
/**
* File content types
*
* Connects file extentions to content-type headers, used by file passthru functions.
*
* Any content types that should be force-download should be preceded with a plus sign.
* The '?' index must be present to represent a default for all not present.
*
* @var array
*
*/
$config->fileContentTypes = array(
'?' => '+application/octet-stream',
'txt' => '+text/plain',
'csv' => '+text/csv',
'pdf' => '+application/pdf',
'doc' => '+application/msword',
'docx' => '+application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xls' => '+application/vnd.ms-excel',
'xlsx' => '+application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'ppt' => '+application/vnd.ms-powerpoint',
'pptx' => '+application/vnd.openxmlformats-officedocument.presentationml.presentation',
'rtf' => '+application/rtf',
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'png' => 'image/png',
'svg' => 'image/svg+xml',
'webp' => 'image/webp',
'zip' => '+application/zip',
'mp3' => 'audio/mpeg',
);
/**
* Named predefined image sizes and options
*
* Specify associative arrays of predefined image sizes indexed by name.
* Each item should have at least 'width' and 'height' indexes. But they can also have any
* other option accepted by the `Pageimage::size()` method `$options` argument.
*
* You can use your defined sizes by name in a Pageimage::size() call by specifying the
* size name rather than the `$width` argument, like this:
* ~~~~~~
* $image = $page->images->first();
* $landscape = $image->size('landscape');
* echo "<img src='$landscape->url' alt='$landscape->description' />";
* ~~~~~~
* Feel free to completely overwrite the default $config->imageSizes in your /site/config.php
* file * as this particular setting is not used by the core.
*
* @var array
* @since 3.0.151
*
*/
$config->imageSizes = array(
// Example 1: Landscape (try this one if you want to test the feature)
'landscape' => array('width' => 600, 'height' => 300),
// Example 2: Thumbnails in admin (260 height, proportional width)
// 'admin' => array('width' => 0, 'height' => 260),
// Example 3: Portrait, with additional options:
// 'portrait' => array('width' => 300, 'height' => 500, 'quality' => 80, 'suffix' => 'portrait'),
// Example 4: Square size cropping towards (preserving) top/center (north):
// 'squareNorth' => array('width' => 400, 'height' => 400, 'cropping' => 'north'),
);
/**
* Image sizer options
*
* Default ImageSizer options, as used by $page->image->size(w, h), for example.
*
* #property bool upscaling Upscale if necessary to reach target size? (1=true, 0=false)
* #property bool cropping Crop if necessary to reach target size? (1=true, 0=false)
* #property bool autoRotation Automatically correct orientation? (1=true, 0=false)
* #property bool interlace Use interlaced JPEGs by default? Recommended. (1=true, 0=false)
* #property string sharpening Sharpening mode, enter one of: none, soft, medium, strong
* #property int quality Image quality, enter a value between 1 and 100, where 100 is highest quality (and largest files)
* #property float defaultGamma Default gamma of 0.5 to 4.0 or -1 to disable gamma correction (default=2.0)
* #property bool webpAdd Create a WEBP copy with every new image variation? (default=false)
*
* @var array
*
*/
$config->imageSizerOptions = array(
'upscaling' => true, // upscale if necessary to reach target size?
'cropping' => true, // crop if necessary to reach target size?
'autoRotation' => true, // automatically correct orientation?
'interlace' => false, // use interlaced JPEGs by default? (recommended)
'sharpening' => 'soft', // sharpening: none | soft | medium | strong
'quality' => 90, // quality: 1-100 where higher is better but bigger
'hidpiQuality' => 60, // Same as above quality setting, but specific to hidpi images
'defaultGamma' => 2.0, // defaultGamma: 0.5 to 4.0 or -1 to disable gamma correction (default=2.0)
'webpAdd' => false, // set this to true, if the imagesizer engines should create a Webp copy with every (new) image variation
);
/**
* Options for webp images
*
* #property int quality Quality setting where 1-100 where higher is better but bigger
* #property bool useSrcExt Use source file extension in webp filename? (file.jpg.webp rather than file.webp)
* #property bool useSrcUrlOnSize Fallback to source file URL when webp file is larger than source?
* #property bool useSrcUrlOnFail Fallback to source file URL when webp file fails for some reason?
*
* @var array
*
*/
$config->webpOptions = array(
'quality' => 90, // Quality setting of 1-100 where higher is better but bigger
'useSrcExt' => false, // Use source file extension in webp filename? (file.jpg.webp rather than file.webp)
'useSrcUrlOnSize' => true, // Fallback to source file URL when webp file is larger than source?
'useSrcUrlOnFail' => true, // Fallback to source file URL when webp file fails for some reason?
);
/**
* Admin thumbnail image options
*
* Controls the output of the thumbnail images used in image fields presented in the admin.
*
* #property int width Width of thumbnails or 0 for proportional to height (default=0).
* #property int height Height of thumbnails or 0 for proportional to width (default=100).
* #property float scale Width/height scale (1=auto detect, 0.5=always hidpi, 1.0=force non-hidpi)
* #property bool upscaling Upscale if necessary to reach target size? (1=true, 0=false).
* #property bool cropping Crop if necessary to reach target size? (1=true, 0=false).
* #property bool autoRotation Automatically correct orientation? (1=true, 0=false).
* #property string sharpening Sharpening mode, enter one of: none, soft, medium, strong (default=soft).
* #property int quality Image quality, enter a value between 1 and 100, where 100 is highest quality, and largest files (default=90).
* #property string suffix Suffix to append to all thumbnail images (1-word of a-z 0-9, default=blank)
*
* @var array
*
*/
$config->adminThumbOptions = array(
'width' => 0, // max width of admin thumbnail or 0 for proportional to height (@deprecated, for legacy use)
'height' => 100, // max height of admin thumbnail or 0 for proportional to width (@deprecated, for legacy use)
'gridSize' => 130, // Squared grid size for images (replaces the 'width' and 'height' settings)
'scale' => 1, // admin thumb scale (1=allow hidpi, 0.5=always hidpi, 1.0=force non-hidpi)
'upscaling' => false,
'cropping' => true,
'autoRotation' => true, // automatically correct orientation?
'sharpening' => 'soft', // sharpening: none | soft | medium | strong
'quality' => 90,
'suffix' => '',
);
/**
* File compiler options (as used by FileCompiler class)
*
* Enables modification of file compiler behaviors. See also $config->moduleCompile
* and $config->templateCompile settings.
*
* #property bool siteOnly Specify true to prevent compiler from attempting compilation outside files in /site/ (default=false).
* #property bool showNotices Show notices in admin about compiled files to superuser when logged in (default=true).
* #property bool logNotices Log notices about compiled files and maintenance to file-compiler.txt log (default=true).
* #property string chmodFile Mode to use for created files, i.e. "0644" (uses $config->chmodFile setting by default).
* #property string chmodDir Mode to use for created dirs, i.e. "0755" (uses $config->chmodDir setting by default).
* #property array exclusions Exclude paths that exist within any of these paths (default includes $config->paths->wire).
* #property array extensions File extensions that we compile (default=php, module, inc).
* #property string cachePath Path where compiled files are stored (default is $config->paths->cache . 'FileCompiler/')
*
* @var array
*
*/
$config->fileCompilerOptions = array(
'siteOnly' => false, // only allow compilation of files in /site/ directory
'showNotices' => true, // show notices about compiled files to superuser when logged in
'logNotices' => true, // log notices about compiled files and maintenance to file-compiler.txt log.
'chmodFile' => '', // mode to use for created files, i.e. "0644"
'chmodDir' => '', // mode to use for created directories, i.e. "0755"
'exclusions' => array(), // exclude filenames or paths that start with any of these
'extensions' => array('php', 'module', 'inc'), // file extensions we compile
'cachePath' => '', // path where compiled files are stored, or blank for $config->paths->cache . 'FileCompiler/'
);
/**
* Temporary directory for uploads
*
* Optionally override PHP's upload_tmp_dir with your own.
*
* @var string
*
* $config->uploadTmpDir = dirname(__FILE__) . '/assets/uploads/'; // example
*
*/
/*** 6. HTTP & INPUT **************************************************************************/
/**
* HTTP hosts
*
* For added security, specify the host names ProcessWire should recognize.
*
* If your site may be accessed from multiple hostnames, you'll also want to use this setting.
* If left empty, the httpHost will be determined automatically, but use of this whitelist
* is recommended for production environments.
*
* If your hostname uses a port other than 80, make sure to include that as well.
* For instance "localhost:8888".
*
* @var array
*
*/
$config->httpHosts = array();
/**
* Runtime HTTP host
*
* This is set automatically by ProcessWire at runtime, consisting of one of the values
* specified in $config->httpHosts. However, if you set a value for this, it will override
* ProcessWire's runtime value.
*
*/
$config->httpHost = '';
/**
* Protect CSRF?
*
* Enables CSRF (cross site request forgery) protection on all PW forms, recommended for improved security.
*
* @var bool
*
*/
$config->protectCSRF = true;
/**
* Maximum URL segments
*
* Maximum number of extra stacked URL segments allowed in a page's URL (including page numbers).
*
* i.e. /path/to/page/s1/s2/s3 where s1, s2 and s3 are URL segments that don't resolve to a page, but can be
* checked in the API via $input->urlSegment1, $input->urlSegment2, $input->urlSegment3, etc.
* To use this, your template settings (under the URL tab) must take advantage of it. Only change this
* number if you need more (or fewer) URL segments for some reason.
*
* Do not change this number below 3, as the admin requires up to 3 URL segments.
*
* @var int
*
*/
$config->maxUrlSegments = 4;
/**
* Maximum length for any individual URL segment (default=128)
*
* @var int
*
*/
$config->maxUrlSegmentLength = 128;
/**
* Maximum URL/path slashes (depth) for request URLs
*
* The maximum number of slashes that any path requested from ProcessWire may have.
* Maximum possible value is 60. Minimum recommended value is 10.
*
* @var int
*
*/
$config->maxUrlDepth = 30;
/**
* Pagination URL prefix
*
* Default prefix used for pagination, i.e. "page2", "page3", etc.
*
* If using multi-language page names, please use the setting in LanguageSupportPageNames module settings instead.
*
* @var string
*
*/
$config->pageNumUrlPrefix = 'page'; // note that "-" is not a supported character in the prefix
/**
* Multiple prefixes that may be used for detecting pagination
*
* Typically used for multi-language support and populated automatically at runtime by
* multi-language support modules. When populated, they override $config->pageNumUrlPrefix.
*
* @internal
*
* $config->pageNumUrlPrefixes = array();
*
*/
/**
* Character set for page names
*
* Set to 'UTF8' (uppercase) to allow for non-ascii word characters in page names.
* You must also update the .htaccess file to allow non-ascii characters through.
* See also $config->pageNameWhitelist, which is used if pageNameCharset is UTF8.
*
* @var string
*
* #notes Value may be either 'ascii' (lowercase) or 'UTF8' (uppercase).
*
*/
$config->pageNameCharset = 'ascii';
/**
* If 'pageNameCharset' is 'UTF8' then specify the whitelist of allowed characters here
*
* Please note this whitelist is only used if pageNameCharset is 'UTF8'.
*
* @var string
*
*/