|
| 1 | +<?php |
| 2 | + |
| 3 | +return [ |
| 4 | + /* |
| 5 | + |-------------------------------------------------------------------------- |
| 6 | + | Source Directories |
| 7 | + |-------------------------------------------------------------------------- |
| 8 | + | |
| 9 | + | Here you may configure the directories from which the image transformer |
| 10 | + | is allowed to serve images. For security reasons, it is recommended |
| 11 | + | to only allow directories which are already publicly accessible. |
| 12 | + | |
| 13 | + | Important: The public storage directory should be addressed directly via |
| 14 | + | storage('app/public') instead of the public_path('storage') link. |
| 15 | + | |
| 16 | + */ |
| 17 | + |
| 18 | + 'source_directories' => [ |
| 19 | + 'images' => public_path('test-data'), |
| 20 | + 'storage' => storage_path('app/public/images'), |
| 21 | + ], |
| 22 | + |
| 23 | + /* |
| 24 | + |-------------------------------------------------------------------------- |
| 25 | + | Default Source Directory |
| 26 | + |-------------------------------------------------------------------------- |
| 27 | + | |
| 28 | + | Below you may configure the default source directory which is used when |
| 29 | + | no specific path prefix is provided in the URL. This should be one of |
| 30 | + | the keys from the source_directories array. |
| 31 | + | |
| 32 | + */ |
| 33 | + |
| 34 | + 'default_source_directory' => env('IMAGE_TRANSFORM_DEFAULT_SOURCE_DIRECTORY', 'images'), |
| 35 | + |
| 36 | + /* |
| 37 | + |-------------------------------------------------------------------------- |
| 38 | + | Route Prefix |
| 39 | + |-------------------------------------------------------------------------- |
| 40 | + | |
| 41 | + | Here you may configure the route prefix of the image transformer. |
| 42 | + | |
| 43 | + */ |
| 44 | + |
| 45 | + 'route_prefix' => env('IMAGE_TRANSFORM_ROUTE_PREFIX', 'image-transform'), |
| 46 | + |
| 47 | + /* |
| 48 | + |-------------------------------------------------------------------------- |
| 49 | + | Enabled Options |
| 50 | + |-------------------------------------------------------------------------- |
| 51 | + | |
| 52 | + | Here you may configure the options which are enabled for the image |
| 53 | + | transformer. |
| 54 | + | |
| 55 | + */ |
| 56 | + |
| 57 | + 'enabled_options' => env('IMAGE_TRANSFORM_ENABLED_OPTIONS', [ |
| 58 | + 'width', |
| 59 | + 'height', |
| 60 | + 'format', |
| 61 | + 'quality', |
| 62 | + 'flip', |
| 63 | + 'contrast', |
| 64 | + 'version', |
| 65 | + 'background', |
| 66 | + // 'blur' |
| 67 | + ]), |
| 68 | + |
| 69 | + /* |
| 70 | + |-------------------------------------------------------------------------- |
| 71 | + | Image Cache |
| 72 | + |-------------------------------------------------------------------------- |
| 73 | + | |
| 74 | + | Here you may configure the image cache settings. The cache is used to |
| 75 | + | store the transformed images for a certain amount of time. This is |
| 76 | + | useful to prevent reprocessing the same image multiple times. |
| 77 | + | The cache is stored in the configured cache disk. |
| 78 | + | |
| 79 | + */ |
| 80 | + |
| 81 | + 'cache' => [ |
| 82 | + 'enabled' => env('IMAGE_TRANSFORM_CACHE_ENABLED', true), |
| 83 | + 'lifetime' => env('IMAGE_TRANSFORM_CACHE_LIFETIME', 60 * 24 * 7), // 7 days |
| 84 | + 'disk' => env('IMAGE_TRANSFORM_CACHE_DISK', 'local'), |
| 85 | + ], |
| 86 | + |
| 87 | + /* |
| 88 | + |-------------------------------------------------------------------------- |
| 89 | + | Rate Limit |
| 90 | + |-------------------------------------------------------------------------- |
| 91 | + | |
| 92 | + | Below you may configure the rate limit which is applied for each image |
| 93 | + | new transformation by the path and IP address. It is recommended to |
| 94 | + | set this to a low value, e.g. 2 requests per minute, to prevent |
| 95 | + | abuse. |
| 96 | + */ |
| 97 | + |
| 98 | + 'rate_limit' => [ |
| 99 | + 'enabled' => env('IMAGE_TRANSFORM_RATE_LIMIT_ENABLED', true), |
| 100 | + 'disabled_for_environments' => [ |
| 101 | + 'local', |
| 102 | + 'testing', |
| 103 | + ], |
| 104 | + 'max_attempts' => env('IMAGE_TRANSFORM_RATE_LIMIT_MAX_REQUESTS', 2), |
| 105 | + 'decay_seconds' => env('IMAGE_TRANSFORM_RATE_LIMIT_DECAY_SECONDS', 60), |
| 106 | + ], |
| 107 | + |
| 108 | + /* |
| 109 | + |-------------------------------------------------------------------------- |
| 110 | + | Response Headers |
| 111 | + |-------------------------------------------------------------------------- |
| 112 | + | |
| 113 | + | Below you may configure the response headers which are added to the |
| 114 | + | response. This is especially useful for controlling caching behavior |
| 115 | + | of CDNs. |
| 116 | + | |
| 117 | + */ |
| 118 | + |
| 119 | + 'headers' => [ |
| 120 | + 'Cache-Control' => env('IMAGE_TRANSFORM_HEADER_CACHE_CONTROL', 'immutable, public, max-age=2592000, s-maxage=2592000'), |
| 121 | + ], |
| 122 | +]; |
0 commit comments