Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Apr 28, 2015
2 parents 2e93fab + 86b762a commit 56cebc0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Changelog

All Notable changes to `laravel-medialibrary` will be documented in this 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
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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


Expand All @@ -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.

Expand Down Expand Up @@ -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

Expand Down
15 changes: 14 additions & 1 deletion src/ImageManipulators/GlideImageManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function createProfileImages(Media $media, $originalFile, $originalPath)
'conversionParameters' => $imageConversionParameters,
'outputFile' => $outputFile,
],
'media_queue'
$this->getQueueName()
);

return;
Expand Down Expand Up @@ -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');
}
}
6 changes: 6 additions & 0 deletions src/ToPublish/config/laravel-medialibrary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
];

0 comments on commit 56cebc0

Please sign in to comment.