plank/laravel-mediable
소개
Laravel-Mediable은 Laravel에서 미디어 파일을 쉽게 업로드하고 모델에 연결할 수 있는 패키지입니다.
웹 및 앱 개발What you can do
- Filesystem-driven approach is easily configurable to allow any number of upload directories with different accessibility. Easily restrict uploads by MIME type, extension and/or aggregate type (e.g. image for JPEG, PNG or GIF).
- Many-to-many polymorphic relationships allow any number of media to be assigned to any number of other models without any need to modify their schema.
- Attach media to models with tags, in order to set and retrieve media for specific purposes, such as 'thumbnail', 'featured image', 'gallery' or 'download'.
- Integrated support for integration/image for manipulating image files to create variants for different use cases.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalLaravel-Mediable
Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel.
Features
- Filesystem-driven approach is easily configurable to allow any number of upload directories with different accessibility. Easily restrict uploads by MIME type, extension and/or aggregate type (e.g.
imagefor JPEG, PNG or GIF). - Many-to-many polymorphic relationships allow any number of media to be assigned to any number of other models without any need to modify their schema.
- Attach media to models with tags, in order to set and retrieve media for specific purposes, such as
'thumbnail','featured image','gallery'or'download'. - Integrated support for integration/image for manipulating image files to create variants for different use cases.
Example Usage
Upload a file to the server, and place it in a directory on the filesystem disk named "uploads". This will create a Media record that can be used to refer to the file.
$media = MediaUploader::fromSource($request->file('thumb'))
->toDestination('uploads', 'blog/thumbnails')
->upload();
Attach the Media to another eloquent model with one or more tags defining their relationship.
$post = Post::create($this->request->input());
$post->attachMedia($media, ['thumbnail']);
Retrieve the media from the model by its tag(s).
$post->getMedia('thumbnail')->first()->getUrl();
Installation
Add the package to your Laravel app using composer
composer require plank/laravel-mediable
Register the package's service provider in config/app.php. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.
'providers' => [
...
Plank\Mediable\MediableServiceProvider::class,
...
];
The package comes with a Facade for the image uploader, which you can optionally register as well. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.
'aliases' => [
...
'MediaUploader' => Plank\Mediable\MediaUploaderFacade::class,
...
]
Publish the config file (config/mediable.php) of the package using artisan.
php artisan vendor:publish --provider="Plank\Mediable\MediableServiceProvider"
Run the migrations to add the required tables to your database.
php artisan migrate
Documentation
Read the documentation here.
License
This package is released under the MIT license (MIT).
About Plank
Plank is a web development agency based in Montreal, Canada.
관련 프로젝트 살펴보기
불러오는 중…