]> _ Git - cubist_cms-back.git/commitdiff
wip #3491 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Mar 2020 16:39:30 +0000 (17:39 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Mar 2020 16:39:30 +0000 (17:39 +0100)
src/app/Magic/Models/CubistMagicAbstractModel.php
src/app/Magic/Models/Settings.php
src/resources/install/config/media-library.php

index 9c89b9bbb861b23ca5aeda7aa6c67cef3c500da3..f62730c20ca7670a031c289f920611c3ccbddcca 100644 (file)
@@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Str;
 use Spatie\MediaLibrary\HasMedia;
 use Spatie\MediaLibrary\InteractsWithMedia;
+use Spatie\MediaLibrary\MediaCollections\Models\Media;
 use Venturecraft\Revisionable\RevisionableTrait;
 
 class CubistMagicAbstractModel extends Model implements HasMedia
@@ -475,7 +476,7 @@ class CubistMagicAbstractModel extends Model implements HasMedia
         return $type;
     }
 
-    public function registerMediaConversions(Media $media = null)
+    public function registerMediaConversions(Media $media = null): void
     {
         $this->addMediaConversion('backpack_thumb')
             ->width(120)
index ff4213d2cabf754eb2b7bcfa36fb41858b555fe7..5f4faecf40fdaf914bd64c37da934752425f8788 100644 (file)
@@ -6,7 +6,7 @@ namespace Cubist\Backpack\app\Magic\Models;
 use Cubist\Backpack\app\Http\Controllers\CubistPWAController;
 use Cubist\Backpack\app\Magic\PageData;
 use Cubist\Backpack\app\Facades\App;
-use Spatie\MediaLibrary\Models\Media;
+use Spatie\MediaLibrary\MediaCollections\Models\Media;
 
 class Settings extends CubistMagicTranslatableModel
 {
@@ -20,7 +20,7 @@ class Settings extends CubistMagicTranslatableModel
         'plural' => 'paramètres',
         'oneinstance' => false];
 
-    public function registerMediaConversions(Media $media = null)
+    public function registerMediaConversions(Media $media = null): void
     {
         parent::registerMediaConversions($media);
 
index 9275e29239c402018a0cd762de8e0a4a7b8c8683..317523078d05f0e4faba85d09561b4f29c777ff6 100644 (file)
@@ -6,13 +6,13 @@ return [
      * The disk on which to store added files and derived images by default. Choose
      * one or more of the disks you've configured in config/filesystems.php.
      */
-    'disk_name' => 'public',
+    'disk_name' => env('MEDIA_DISK', 'public'),
 
     /*
      * The maximum file size of an item in bytes.
      * Adding a larger file will result in an exception.
      */
-    'max_file_size' => 1024 * 1024 * 1024,
+    'max_file_size' => 1024 * 1024 * 10,
 
     /*
      * This queue will be used to generate derived and responsive images.
@@ -23,14 +23,7 @@ return [
     /*
      * The fully qualified class name of the media model.
      */
-    'media_model' => Spatie\MediaLibrary\Models\Media::class,
-
-    's3' => [
-        /*
-         * The domain that should be prepended when generating urls.
-         */
-        'domain' => 'https://'.env('AWS_BUCKET').'.s3.amazonaws.com',
-    ],
+    'media_model' => Spatie\MediaLibrary\MediaCollections\Models\Media::class,
 
     'remote' => [
         /*
@@ -49,12 +42,12 @@ return [
     'responsive_images' => [
 
         /*
-        * This class is responsible for calculating the target widths of the responsive
-        * images. By default we optimize for filesize and create variations that each are 20%
-        * smaller than the previous one. More info in the documentation.
-        *
-        * https://docs.spatie.be/laravel-medialibrary/v7/advanced-usage/generating-responsive-images
-        */
+         * This class is responsible for calculating the target widths of the responsive
+         * images. By default we optimize for filesize and create variations that each are 20%
+         * smaller than the previous one. More info in the documentation.
+         *
+         * https://docs.spatie.be/laravel-medialibrary/v8/advanced-usage/generating-responsive-images
+         */
         'width_calculator' => Spatie\MediaLibrary\ResponsiveImages\WidthCalculator\FileSizeOptimizedWidthCalculator::class,
 
         /*
@@ -70,19 +63,42 @@ return [
         'tiny_placeholder_generator' => Spatie\MediaLibrary\ResponsiveImages\TinyPlaceholderGenerator\Blurred::class,
     ],
 
+    /*
+     * When converting Media instances to response the medialibrary will add
+     * a `loading` attribute to the `img` tag. Here you can set the default
+     * value of that attribute.
+     *
+     * Possible values: 'auto', 'lazy' and 'eager,
+     *
+     * More info: https://css-tricks.com/native-lazy-loading/
+     */
+    'default_loading_attribute_value' => 'auto',
+
+    /*
+     * This is the class that is responsible for naming conversion files. By default,
+     * it will use the filename of the original and concatenate the conversion name to it.
+     */
+    'conversion_file_namer' => \Spatie\MediaLibrary\Conversions\DefaultConversionFileNamer::class,
+
+    /*
+     * The class that contains the strategy for determining a media file's path.
+     */
+    'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,
+
     /*
      * When urls to files get generated, this class will be called. Leave empty
      * if your files are stored locally above the site root or on s3.
      */
-    'url_generator' => null,
+    'url_generator' => Spatie\MediaLibrary\Support\UrlGenerator\DefaultUrlGenerator::class,
 
     /*
-     * The class that contains the strategy for determining a media file's path.
+     * Whether to activate versioning when urls to files get generated.
+     * When activated, this attaches a ?v=xx query string to the URL.
      */
-    'path_generator' => null,
+    'version_urls' => false,
 
     /*
-     * Medialibrary will try to optimize all converted images by removing
+     * MediaLibrary will try to optimize all converted images by removing
      * metadata and applying a little bit of compression. These are
      * the optimizers that will be used by default.
      */
@@ -112,18 +128,18 @@ return [
      * These generators will be used to create an image of media files.
      */
     'image_generators' => [
-        Spatie\MediaLibrary\ImageGenerators\FileTypes\Image::class,
-        Spatie\MediaLibrary\ImageGenerators\FileTypes\Webp::class,
-        Spatie\MediaLibrary\ImageGenerators\FileTypes\Pdf::class,
-        Spatie\MediaLibrary\ImageGenerators\FileTypes\Svg::class,
-        Spatie\MediaLibrary\ImageGenerators\FileTypes\Video::class,
+        Spatie\MediaLibrary\Conversions\ImageGenerators\Image::class,
+        Spatie\MediaLibrary\Conversions\ImageGenerators\Webp::class,
+        Spatie\MediaLibrary\Conversions\ImageGenerators\Pdf::class,
+        Spatie\MediaLibrary\Conversions\ImageGenerators\Svg::class,
+        Spatie\MediaLibrary\Conversions\ImageGenerators\Video::class,
     ],
 
     /*
      * The engine that should perform the image conversions.
      * Should be either `gd` or `imagick`.
      */
-    'image_driver' => 'gd',
+    'image_driver' => env('IMAGE_DRIVER', 'gd'),
 
     /*
      * FFMPEG & FFProbe binaries paths, only used if you try to generate video
@@ -144,7 +160,7 @@ return [
      * your custom jobs extend the ones provided by the package.
      */
     'jobs' => [
-        'perform_conversions' => Spatie\MediaLibrary\Jobs\PerformConversions::class,
-        'generate_responsive_images' => Spatie\MediaLibrary\Jobs\GenerateResponsiveImages::class,
+        'perform_conversions' => \Spatie\MediaLibrary\Conversions\Jobs\PerformConversionsJob::class,
+        'generate_responsive_images' => \Spatie\MediaLibrary\ResponsiveImages\Jobs\GenerateResponsiveImagesJob::class,
     ],
 ];