https://github.com/e200/mediavel
Laravel media library package
https://github.com/e200/mediavel
laravel media-library
Last synced: 5 months ago
JSON representation
Laravel media library package
- Host: GitHub
- URL: https://github.com/e200/mediavel
- Owner: e200
- License: other
- Created: 2018-12-23T11:00:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-03-29T22:21:27.000Z (about 4 years ago)
- Last Synced: 2024-04-26T21:21:54.066Z (about 2 years ago)
- Topics: laravel, media-library
- Language: PHP
- Size: 212 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Contributing: contributing.md
- License: license.md
Awesome Lists containing this project
README
# Mediavel
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Total Downloads][ico-downloads]][link-downloads]
[![Build Status][ico-travis]][link-travis]
[![StyleCI][ico-styleci]][link-styleci]
A media library handler for Laravel.
Right now, it only supports upload images and generate thumbnails from them.
## Installation
Via Composer
``` bash
$ composer require e200/mediavel
```
## Usage
```php
namespace App\Http\Controllers;
use Illuminate\Routing\Controller;
use e200\Mediavel\Facades\MediaLibrary;
class ImageController extends Controller
{
public function upload(Request $request)
{
$uploadedImage = $request->image;
$media = $mediaLibrary
->add($uploadedImage) // Store the image
->preserveOriginal() // Do not touch the original file
->resize('small', [75, 75]) // Creates a thumbnail (75x75) derived from the original image
->resize('medium', [150, 150]) // Creates a thumbnail (150x150)
->resize('large', [1024, 300]); // Creates a thumbnail (1024x300);
$media->id; // 1
$media->relative_path; // /images/2018/12/sl290s8xq0is9wqjk.jpg
$media->url; // http://localhost:8000/images/2019/06/5cf6976f20dfb.jpg
$thumbs = $media->thumbs();
$thumbs['small']->path; // /images/2018/12/5cf6976f20dfb-75x75.jpg
$thumbs['medium']->path; // /images/2018/12/5cf6976f20dfb-150x150.jpg
$thumbs['large']->path; // /images/2018/12/5cf6976f20dfb-1024x300.jpg
}
}
```
## Change log
Please see the [changelog](changelog.md) for more information on what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [contributing.md](contributing.md) for details and a todolist.
## Security
If you discover any security related issues, please email eleandro@inbox.ru instead of using the issue tracker.
## Credits
- [Eleandro Duzentos][link-author]
- [All Contributors][link-contributors]
## License
MIT. Please see the [license file](license.md) for more information.
[ico-version]: https://img.shields.io/packagist/v/e200/mediavel.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/e200/mediavel.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/e200/mediavel/master.svg?style=flat-square
[ico-styleci]: https://styleci.io/repos/12345678/shield
[link-packagist]: https://packagist.org/packages/e200/mediavel
[link-downloads]: https://packagist.org/packages/e200/mediavel
[link-travis]: https://travis-ci.org/e200/mediavel
[link-styleci]: https://styleci.io/repos/12345678
[link-author]: https://github.com/e200
[link-contributors]: ../../contributors