Issues (1497)

src/config.php (8 issues)

1
<?php
2
/**
3
 * ImageOptimize plugin for Craft CMS
4
 *
5
 * Automatically optimize images after they've been transformed
6
 *
7
 * @link      https://nystudio107.com
0 ignored issues
show
The tag in position 1 should be the @copyright tag
Loading history...
8
 * @copyright Copyright (c) 2017 nystudio107
0 ignored issues
show
@copyright tag must contain a year and the name of the copyright holder
Loading history...
9
 */
0 ignored issues
show
PHP version not specified
Loading history...
Missing @category tag in file comment
Loading history...
Missing @package tag in file comment
Loading history...
Missing @author tag in file comment
Loading history...
Missing @license tag in file comment
Loading history...
10
11
use nystudio107\imageoptimize\imagetransforms\CraftImageTransform;
12
13
/**
14
 * ImageOptimize config.php
15
 *
16
 * This file exists only as a template for the ImageOptimize settings.
17
 * It does nothing on its own.
18
 *
19
 * Don't edit this file, instead copy it to 'craft/config' as
20
 * 'image-optimize.php' and make your changes there to override default
21
 * settings.
22
 *
23
 * Once copied to 'craft/config', this file will be multi-environment aware as
24
 * well, so you can have different settings groups for each environment, just
25
 * as
26
 * you do for 'general.php'
27
 */
28
29
return [
30
    //  The image transform class to use for image transforms
31
    'transformClass' => CraftImageTransform::class,
32
33
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
34
     * @var array Settings for the image transform components
35
     *
36
     * The data is stored in the following format, with the key being the class
37
     * of the image transform method:
38
     *
39
     * 'imageTransformTypeSettings' => [
40
     *    ImgixImageTransform::class => [
41
     *        'domain' => 'XXXXX',
42
     *        'apiKey' => 'XXXXX',
43
     *        'securityToken' => 'XXXXX',
44
     *    ]
45
     * ],
46
     */
47
    'imageTransformTypeSettings' => [],
48
49
    // Should the image variants in an Asset Volume be automatically re-saved when saving
50
    // an OptimizedImages field, saving an Asset Volume that has an OptimizedImages field
51
    // in its layout, or saving the ImageOptimized settings. Set this to false only if
52
    // you will be manually using the CLI console command to resave image variants
53
    'automaticallyResaveImageVariants' => true,
54
55
    // Should image variant be created on Asset save (aka BeforePageLoad)
56
    'generateTransformsBeforePageLoad' => true,
57
58
    // Set to false to disable all placeholder generation
59
    'generatePlaceholders' => true,
60
61
    // Whether the placeholder silhouette SVGs should be capped at 32Kb in size
62
    'capSilhouetteSvgSize' => true,
63
64
    // Controls whether a dominant color palette should be created for image variants
65
    // It takes a bit of time, so if you never plan to use it, you can turn it off
66
    'createColorPalette' => true,
67
68
    // Controls whether SVG placeholder silhouettes should be created for image variants
69
    // It takes a bit of time, so if you never plan to use them, you can turn it off
70
    'createPlaceholderSilhouettes' => false,
71
72
    // Controls whether retina images are automatically created with reduced quality
73
    // as per https://www.netvlies.nl/blogs/retina-revolutie-follow
74
    'lowerQualityRetinaImageVariants' => true,
75
76
    // Controls whether Optimized Image Variants are created that would be up-scaled
77
    // to be larger than the original source image
78
    'allowUpScaledImageVariants' => false,
79
80
    // Controls whether images scaled down >= 50% should be automatically sharpened
81
    'autoSharpenScaledImages' => true,
82
83
    // The amount an image needs to be scaled down for automatic sharpening to be applied
84
    'sharpenScaledImagePercentage' => 50,
85
86
    // Whether to allow limiting the creation of Optimized Image Variants for images by sub-folders
87
    'assetVolumeSubFolders' => true,
88
89
    // The default Image Transform type classes
90
    'defaultImageTransformTypes' => [
91
    ],
92
93
    // Default aspect ratios
94
    'defaultAspectRatios' => [
95
        ['x' => 16, 'y' => 9],
96
        ['x' => 8, 'y' => 5],
97
        ['x' => 4, 'y' => 3],
98
        ['x' => 5, 'y' => 4],
99
        ['x' => 1, 'y' => 1],
100
        ['x' => 9, 'y' => 16],
101
        ['x' => 5, 'y' => 8],
102
        ['x' => 3, 'y' => 4],
103
        ['x' => 4, 'y' => 5],
104
    ],
105
106
    // Default image variants
107
    'defaultVariants' => [
108
        [
109
            'width' => 1200,
110
            'useAspectRatio' => true,
111
            'aspectRatioX' => 16.0,
112
            'aspectRatioY' => 9.0,
113
            'retinaSizes' => ['1'],
114
            'quality' => 82,
115
            'format' => 'jpg',
116
        ],
117
        [
118
            'width' => 992,
119
            'useAspectRatio' => true,
120
            'aspectRatioX' => 16.0,
121
            'aspectRatioY' => 9.0,
122
            'retinaSizes' => ['1'],
123
            'quality' => 82,
124
            'format' => 'jpg',
125
        ],
126
        [
127
            'width' => 768,
128
            'useAspectRatio' => true,
129
            'aspectRatioX' => 4.0,
130
            'aspectRatioY' => 3.0,
131
            'retinaSizes' => ['1'],
132
            'quality' => 60,
133
            'format' => 'jpg',
134
        ],
135
        [
136
            'width' => 576,
137
            'useAspectRatio' => true,
138
            'aspectRatioX' => 4.0,
139
            'aspectRatioY' => 3.0,
140
            'retinaSizes' => ['1'],
141
            'quality' => 60,
142
            'format' => 'jpg',
143
        ],
144
    ],
145
146
    // Active image processors
147
    'activeImageProcessors' => [
148
        'jpg' => [
149
            'jpegoptim',
150
        ],
151
        'png' => [
152
            'optipng',
153
        ],
154
        'svg' => [
155
            'svgo',
156
        ],
157
        'gif' => [
158
            'gifsicle',
159
        ],
160
    ],
161
162
    // Active image variant creators
163
    'activeImageVariantCreators' => [
164
        'jpg' => [
165
            'cwebp',
166
        ],
167
        'png' => [
168
            'cwebp',
169
        ],
170
        'gif' => [
171
            'cwebp',
172
        ],
173
    ],
174
175
    // Preset image processors
176
    'imageProcessors' => [
177
        // jpeg optimizers
178
        'jpegoptim' => [
179
            'commandPath' => '/usr/bin/jpegoptim',
180
            'commandOptions' => '-s',
181
            'commandOutputFileFlag' => '',
182
        ],
183
        'mozjpeg' => [
184
            'commandPath' => '/usr/bin/mozjpeg',
185
            'commandOptions' => '-optimize -copy none',
186
            'commandOutputFileFlag' => '-outfile',
187
        ],
188
        'jpegtran' => [
189
            'commandPath' => '/usr/bin/jpegtran',
190
            'commandOptions' => '-optimize -copy none',
191
            'commandOutputFileFlag' => '',
192
        ],
193
        // png optimizers
194
        'optipng' => [
195
            'commandPath' => '/usr/bin/optipng',
196
            'commandOptions' => '-o3 -strip all',
197
            'commandOutputFileFlag' => '',
198
        ],
199
        'pngcrush' => [
200
            'commandPath' => '/usr/bin/pngcrush',
201
            'commandOptions' => '-brute -ow',
202
            'commandOutputFileFlag' => '',
203
        ],
204
        'pngquant' => [
205
            'commandPath' => '/usr/bin/pngquant',
206
            'commandOptions' => '--strip--skip -if-larger',
207
            'commandOutputFileFlag' => '',
208
        ],
209
        // svg optimizers
210
        'svgo' => [
211
            'commandPath' => '/usr/bin/svgo',
212
            'commandOptions' => '',
213
            'commandOutputFileFlag' => '',
214
        ],
215
        // gif optimizers
216
        'gifsicle' => [
217
            'commandPath' => '/usr/bin/gifsicle',
218
            'commandOptions' => '-O3 -k 256',
219
            'commandOutputFileFlag' => '',
220
        ],
221
    ],
222
223
    'imageVariantCreators' => [
224
        // webp variant creator
225
        'cwebp' => [
226
            'commandPath' => '/usr/bin/cwebp',
227
            'commandOptions' => '',
228
            'commandOutputFileFlag' => '-o',
229
            'commandQualityFlag' => '-q',
230
            'imageVariantExtension' => 'webp',
231
        ],
232
    ],
233
234
];
235