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.

179 lines
6.9 KiB

  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', 'public'),
  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. 'remote' => [
  27. /*
  28. * Any extra headers that should be included when uploading media to
  29. * a remote disk. Even though supported headers may vary between
  30. * different drivers, a sensible default has been provided.
  31. *
  32. * Supported by S3: CacheControl, Expires, StorageClass,
  33. * ServerSideEncryption, Metadata, ACL, ContentEncoding
  34. */
  35. 'extra_headers' => [
  36. 'CacheControl' => 'max-age=604800',
  37. ],
  38. ],
  39. 'responsive_images' => [
  40. /*
  41. * This class is responsible for calculating the target widths of the responsive
  42. * images. By default we optimize for filesize and create variations that each are 20%
  43. * smaller than the previous one. More info in the documentation.
  44. *
  45. * https://docs.spatie.be/laravel-medialibrary/v8/advanced-usage/generating-responsive-images
  46. */
  47. 'width_calculator' => Spatie\MediaLibrary\ResponsiveImages\WidthCalculator\FileSizeOptimizedWidthCalculator::class,
  48. /*
  49. * By default rendering media to a responsive image will add some javascript and a tiny placeholder.
  50. * This ensures that the browser can already determine the correct layout.
  51. */
  52. 'use_tiny_placeholders' => true,
  53. /*
  54. * This class will generate the tiny placeholder used for progressive image loading. By default
  55. * the media library will use a tiny blurred jpg image.
  56. */
  57. 'tiny_placeholder_generator' => Spatie\MediaLibrary\ResponsiveImages\TinyPlaceholderGenerator\Blurred::class,
  58. ],
  59. /*
  60. * When converting Media instances to response the media library will add
  61. * a `loading` attribute to the `img` tag. Here you can set the default
  62. * value of that attribute.
  63. *
  64. * Possible values: 'lazy', 'eager', 'auto' or null if you don't want to set any loading instruction.
  65. *
  66. * More info: https://css-tricks.com/native-lazy-loading/
  67. */
  68. 'default_loading_attribute_value' => null,
  69. /*
  70. * This is the class that is responsible for naming conversion files. By default,
  71. * it will use the filename of the original and concatenate the conversion name to it.
  72. */
  73. 'conversion_file_namer' => App\Utilities\Avatar\DefaultConversionFileNamer::class,
  74. /*
  75. * The class that contains the strategy for determining a media file's path.
  76. */
  77. 'path_generator' => App\Utilities\Avatar\DefaultPathGenerator::class,
  78. /*
  79. * When urls to files get generated, this class will be called. Use the default
  80. * if your files are stored locally above the site root or on s3.
  81. */
  82. 'url_generator' => Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class,
  83. /*
  84. * Whether to activate versioning when urls to files get generated.
  85. * When activated, this attaches a ?v=xx query string to the URL.
  86. */
  87. 'version_urls' => false,
  88. /*
  89. * The media library will try to optimize all converted images by removing
  90. * metadata and applying a little bit of compression. These are
  91. * the optimizers that will be used by default.
  92. */
  93. 'image_optimizers' => [
  94. Spatie\ImageOptimizer\Optimizers\Jpegoptim::class => [
  95. '--strip-all', // this strips out all text information such as comments and EXIF data
  96. '--all-progressive', // this will make sure the resulting image is a progressive one
  97. ],
  98. Spatie\ImageOptimizer\Optimizers\Pngquant::class => [
  99. '--force', // required parameter for this package
  100. ],
  101. Spatie\ImageOptimizer\Optimizers\Optipng::class => [
  102. '-i0', // this will result in a non-interlaced, progressive scanned image
  103. '-o2', // this set the optimization level to two (multiple IDAT compression trials)
  104. '-quiet', // required parameter for this package
  105. ],
  106. Spatie\ImageOptimizer\Optimizers\Svgo::class => [
  107. '--disable=cleanupIDs', // disabling because it is known to cause troubles
  108. ],
  109. Spatie\ImageOptimizer\Optimizers\Gifsicle::class => [
  110. '-b', // required parameter for this package
  111. '-O3', // this produces the slowest but best results
  112. ],
  113. ],
  114. /*
  115. * These generators will be used to create an image of media files.
  116. */
  117. 'image_generators' => [
  118. Spatie\MediaLibrary\Conversions\ImageGenerators\Image::class,
  119. Spatie\MediaLibrary\Conversions\ImageGenerators\Webp::class,
  120. Spatie\MediaLibrary\Conversions\ImageGenerators\Pdf::class,
  121. Spatie\MediaLibrary\Conversions\ImageGenerators\Svg::class,
  122. Spatie\MediaLibrary\Conversions\ImageGenerators\Video::class,
  123. ],
  124. /*
  125. * The engine that should perform the image conversions.
  126. * Should be either `gd` or `imagick`.
  127. */
  128. 'image_driver' => env('IMAGE_DRIVER', 'gd'),
  129. /*
  130. * FFMPEG & FFProbe binaries paths, only used if you try to generate video
  131. * thumbnails and have installed the php-ffmpeg/php-ffmpeg composer
  132. * dependency.
  133. */
  134. 'ffmpeg_path' => env('FFMPEG_PATH', '/usr/bin/ffmpeg'),
  135. 'ffprobe_path' => env('FFPROBE_PATH', '/usr/bin/ffprobe'),
  136. /*
  137. * The path where to store temporary files while performing image conversions.
  138. * If set to null, storage_path('media-library/temp') will be used.
  139. */
  140. 'temporary_directory_path' => null,
  141. /*
  142. * Here you can override the class names of the jobs used by this package. Make sure
  143. * your custom jobs extend the ones provided by the package.
  144. */
  145. 'jobs' => [
  146. 'perform_conversions' => Spatie\MediaLibrary\Conversions\Jobs\PerformConversionsJob::class,
  147. 'generate_responsive_images' => Spatie\MediaLibrary\ResponsiveImages\Jobs\GenerateResponsiveImagesJob::class,
  148. ],
  149. /*
  150. * When using the addMediaFromUrl method you may want to replace the default downloader.
  151. * This is particularly useful when the url of the image is behind a firewall and
  152. * need to add additional flags, possibly using curl.
  153. */
  154. 'media_downloader' => Spatie\MediaLibrary\Downloaders\DefaultDownloader::class,
  155. ];