diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af29aa7a..e8189298f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ # Changelog -All Notable changes to `laravel-medialibrary` will be documented in this file \ No newline at end of file +All Notable changes to `laravel-medialibrary` will be documented in this file + +##1.1.0 +- Added option to specify the name of the queue that should be used to create image manipulations + +##1.0.0 +- initial release diff --git a/README.md b/README.md index 2fbe37ef7..12ece9ffc 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Latest Version](https://img.shields.io/github/release/freekmurze/laravel-medialibrary.svg?style=flat-square)](https://github.com/freekmurze/laravel-medialibrary/releases) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) -[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/27cf455a-0555-4bcf-abae-16b5f7860d09.svg)](https://insight.sensiolabs.com/projects/27cf455a-0555-4bcf-abae-16b5f7860d09) +[![SensioLabsInsight](https://insight.sensiolabs.com/projects/27cf455a-0555-4bcf-abae-16b5f7860d09/mini.png)](https://insight.sensiolabs.com/projects/27cf455a-0555-4bcf-abae-16b5f7860d09) [![Quality Score](https://img.shields.io/scrutinizer/g/freekmurze/laravel-medialibrary.svg?style=flat-square)](https://scrutinizer-ci.com/g/freekmurze/laravel-medialibrary) [![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-medialibrary.svg?style=flat-square)](https://packagist.org/packages/spatie/:laravel-medialibrary) @@ -74,9 +74,17 @@ return [ * See the README of the package for an example. */ 'globalImageProfiles' => [], + + /* + * The medialibrary will used this queue to generate derived images. + * Leave empty to use the default queue. + */ + 'queueName' => 'media_queue', ]; ``` +If you are planning on working with the image manipulations you should configure a queue on your service with the name specified in the config file. + ## Basic usage @@ -103,7 +111,7 @@ Using the facade you can add items to the library like this: ```php $collectionName = 'myFirstCollection' $newsItem = News::find(1); -Medialibrary::add($pathToAFile, $newsItem, $collectionName); +MediaLibrary::add($pathToAFile, $newsItem, $collectionName); ``` Adding a file will move your file to a directory managed by the medialibrary. @@ -208,7 +216,7 @@ You can also generate a derived image on the fly by passing an array with parame $mediaItem->getURL(['w' => 450, 'h' => 200, 'filt' => 'greyscale']); ``` -This call will generated an url that, when hit, will generate the derived image. +This call will generate an url that, when hit, will generate the derived image. ## Contributing diff --git a/src/ImageManipulators/GlideImageManipulator.php b/src/ImageManipulators/GlideImageManipulator.php index 6ef402468..3d16d93b0 100644 --- a/src/ImageManipulators/GlideImageManipulator.php +++ b/src/ImageManipulators/GlideImageManipulator.php @@ -84,7 +84,7 @@ private function createProfileImages(Media $media, $originalFile, $originalPath) 'conversionParameters' => $imageConversionParameters, 'outputFile' => $outputFile, ], - 'media_queue' + $this->getQueueName() ); return; @@ -175,4 +175,17 @@ private function getModelImageProfiles($className) return $model->imageProfiles; } + + /** + * @return string + */ + private function getQueueName() + { + if (config('laravel-medialibrary.queueName') == '') + { + return null; + } + + return config('laravel-medialibrary.queueName'); + } } diff --git a/src/ToPublish/config/laravel-medialibrary.php b/src/ToPublish/config/laravel-medialibrary.php index b473ced91..8c846e350 100644 --- a/src/ToPublish/config/laravel-medialibrary.php +++ b/src/ToPublish/config/laravel-medialibrary.php @@ -25,4 +25,10 @@ * See the README of the package for an example. */ 'globalImageProfiles' => [], + + /* + * The medialibrary will used this queue to generate derived images. + * Leave empty to use the default queue. + */ + 'queueName' => 'media_queue', ];