You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

215 lines
8.4 KiB

1 month ago
  1. <?php
  2. return [
  3. /*
  4. * The disk on which to store added files and derived images by default. Choose
  5. * one or more of the disks you've configured in config/filesystems.php.
  6. */
  7. 'disk_name' => env('MEDIA_DISK', config('shop.media_disk')),
  8. /*
  9. * The maximum file size of an item in bytes.
  10. * Adding a larger file will result in an exception.
  11. */
  12. 'max_file_size' => 1024 * 1024 * 10,
  13. /*
  14. * This queue will be used to generate derived and responsive images.
  15. * Leave empty to use the default queue.
  16. */
  17. 'queue_name' => '',
  18. /*
  19. * By default all conversions will be performed on a queue.
  20. */
  21. 'queue_conversions_by_default' => env('QUEUE_CONVERSIONS_BY_DEFAULT', true),
  22. /*
  23. * The fully qualified class name of the media model.
  24. */
  25. 'media_model' => Spatie\MediaLibrary\MediaCollections\Models\Media::class,
  26. /*
  27. * The fully qualified class name of the model used for temporary uploads.
  28. *
  29. * This model is only used in Media Library Pro (https://medialibrary.pro)
  30. */
  31. 'temporary_upload_model' => Spatie\MediaLibraryPro\Models\TemporaryUpload::class,
  32. /*
  33. * When enabled, Media Library Pro will only process temporary uploads there were uploaded
  34. * in the same session. You can opt to disable this for stateless usage of
  35. * the pro components.
  36. */
  37. 'enable_temporary_uploads_session_affinity' => true,
  38. /*
  39. * When enabled, Media Library pro will generate thumbnails for uploaded file.
  40. */
  41. 'generate_thumbnails_for_temporary_uploads' => true,
  42. /*
  43. * This is the class that is responsible for naming generated files.
  44. */
  45. 'file_namer' => Spatie\MediaLibrary\Support\FileNamer\DefaultFileNamer::class,
  46. /*
  47. * The class that contains the strategy for determining a media file's path.
  48. */
  49. 'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,
  50. /*
  51. * When urls to files get generated, this class will be called. Use the default
  52. * if your files are stored locally above the site root or on s3.
  53. */
  54. 'url_generator' => Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class,
  55. /*
  56. * Moves media on updating to keep path consistent. Enable it only with a custom
  57. * PathGenerator that uses, for example, the media UUID.
  58. */
  59. 'moves_media_on_update' => false,
  60. /*
  61. * Whether to activate versioning when urls to files get generated.
  62. * When activated, this attaches a ?v=xx query string to the URL.
  63. */
  64. 'version_urls' => false,
  65. /*
  66. * The media library will try to optimize all converted images by removing
  67. * metadata and applying a little bit of compression. These are
  68. * the optimizers that will be used by default.
  69. */
  70. 'image_optimizers' => [
  71. Spatie\ImageOptimizer\Optimizers\Jpegoptim::class => [
  72. '-m85', // set maximum quality to 85%
  73. '--strip-all', // this strips out all text information such as comments and EXIF data
  74. '--all-progressive', // this will make sure the resulting image is a progressive one
  75. ],
  76. Spatie\ImageOptimizer\Optimizers\Pngquant::class => [
  77. '--force', // required parameter for this package
  78. ],
  79. Spatie\ImageOptimizer\Optimizers\Optipng::class => [
  80. '-i0', // this will result in a non-interlaced, progressive scanned image
  81. '-o2', // this set the optimization level to two (multiple IDAT compression trials)
  82. '-quiet', // required parameter for this package
  83. ],
  84. Spatie\ImageOptimizer\Optimizers\Svgo::class => [
  85. '--disable=cleanupIDs', // disabling because it is known to cause troubles
  86. ],
  87. Spatie\ImageOptimizer\Optimizers\Gifsicle::class => [
  88. '-b', // required parameter for this package
  89. '-O3', // this produces the slowest but best results
  90. ],
  91. Spatie\ImageOptimizer\Optimizers\Cwebp::class => [
  92. '-m 6', // for the slowest compression method in order to get the best compression.
  93. '-pass 10', // for maximizing the amount of analysis pass.
  94. '-mt', // multithreading for some speed improvements.
  95. '-q 90', //quality factor that brings the least noticeable changes.
  96. ],
  97. ],
  98. /*
  99. * These generators will be used to create an image of media files.
  100. */
  101. 'image_generators' => [
  102. Spatie\MediaLibrary\Conversions\ImageGenerators\Image::class,
  103. Spatie\MediaLibrary\Conversions\ImageGenerators\Webp::class,
  104. Spatie\MediaLibrary\Conversions\ImageGenerators\Pdf::class,
  105. Spatie\MediaLibrary\Conversions\ImageGenerators\Svg::class,
  106. Spatie\MediaLibrary\Conversions\ImageGenerators\Video::class,
  107. ],
  108. /*
  109. * The path where to store temporary files while performing image conversions.
  110. * If set to null, storage_path('media-library/temp') will be used.
  111. */
  112. 'temporary_directory_path' => null,
  113. /*
  114. * The engine that should perform the image conversions.
  115. * Should be either `gd` or `imagick`.
  116. */
  117. 'image_driver' => env('IMAGE_DRIVER', 'gd'),
  118. /*
  119. * FFMPEG & FFProbe binaries paths, only used if you try to generate video
  120. * thumbnails and have installed the php-ffmpeg/php-ffmpeg composer
  121. * dependency.
  122. */
  123. 'ffmpeg_path' => env('FFMPEG_PATH', '/usr/bin/ffmpeg'),
  124. 'ffprobe_path' => env('FFPROBE_PATH', '/usr/bin/ffprobe'),
  125. /*
  126. * Here you can override the class names of the jobs used by this package. Make sure
  127. * your custom jobs extend the ones provided by the package.
  128. */
  129. 'jobs' => [
  130. 'perform_conversions' => Spatie\MediaLibrary\Conversions\Jobs\PerformConversionsJob::class,
  131. 'generate_responsive_images' => Spatie\MediaLibrary\ResponsiveImages\Jobs\GenerateResponsiveImagesJob::class,
  132. ],
  133. /*
  134. * When using the addMediaFromUrl method you may want to replace the default downloader.
  135. * This is particularly useful when the url of the image is behind a firewall and
  136. * need to add additional flags, possibly using curl.
  137. */
  138. 'media_downloader' => Spatie\MediaLibrary\Downloaders\DefaultDownloader::class,
  139. 'remote' => [
  140. /*
  141. * Any extra headers that should be included when uploading media to
  142. * a remote disk. Even though supported headers may vary between
  143. * different drivers, a sensible default has been provided.
  144. *
  145. * Supported by S3: CacheControl, Expires, StorageClass,
  146. * ServerSideEncryption, Metadata, ACL, ContentEncoding
  147. */
  148. 'extra_headers' => [
  149. 'CacheControl' => 'max-age=604800',
  150. ],
  151. ],
  152. 'responsive_images' => [
  153. /*
  154. * This class is responsible for calculating the target widths of the responsive
  155. * images. By default we optimize for filesize and create variations that each are 20%
  156. * smaller than the previous one. More info in the documentation.
  157. *
  158. * https://docs.spatie.be/laravel-medialibrary/v9/advanced-usage/generating-responsive-images
  159. */
  160. 'width_calculator' => Spatie\MediaLibrary\ResponsiveImages\WidthCalculator\FileSizeOptimizedWidthCalculator::class,
  161. /*
  162. * By default rendering media to a responsive image will add some javascript and a tiny placeholder.
  163. * This ensures that the browser can already determine the correct layout.
  164. */
  165. 'use_tiny_placeholders' => true,
  166. /*
  167. * This class will generate the tiny placeholder used for progressive image loading. By default
  168. * the media library will use a tiny blurred jpg image.
  169. */
  170. 'tiny_placeholder_generator' => Spatie\MediaLibrary\ResponsiveImages\TinyPlaceholderGenerator\Blurred::class,
  171. ],
  172. /*
  173. * When enabling this option, a route will be registered that will enable
  174. * the Media Library Pro Vue and React components to move uploaded files
  175. * in a S3 bucket to their right place.
  176. */
  177. 'enable_vapor_uploads' => env('ENABLE_MEDIA_LIBRARY_VAPOR_UPLOADS', false),
  178. /*
  179. * When converting Media instances to response the media library will add
  180. * a `loading` attribute to the `img` tag. Here you can set the default
  181. * value of that attribute.
  182. *
  183. * Possible values: 'lazy', 'eager', 'auto' or null if you don't want to set any loading instruction.
  184. *
  185. * More info: https://css-tricks.com/native-lazy-loading/
  186. */
  187. 'default_loading_attribute_value' => null,
  188. ];