Skip to content

Files

Latest commit

21b42eb · Oct 30, 2020

History

History
50 lines (35 loc) · 2.62 KB

introduction.md

File metadata and controls

50 lines (35 loc) · 2.62 KB
title weight
Introduction
1

This package can associate all sorts of files with Eloquent models. It provides a simple, fluent API to work with. The Pro version of the package offers Blade, Vue and React components to handle uploads to the media library and to adminster the content of a medialibrary collection.

Here are some quick code examples:

$yourModel = YourModel::find(1);
$yourModel->addMedia($pathToFile)->toMediaCollection('images');

It can also directly handle your uploads:

$yourModel->addMediaFromRequest('image')->toMediaCollection('images');

Want to store some large files on another filesystem? No problem:

$yourModel->addMedia($smallFile)->toMediaCollection('downloads', 'local');
$yourModel->addMedia($bigFile)->toMediaCollection('downloads', 's3');

The storage of the files is handled by Laravel's Filesystem, so you can plug in any compatible filesystem.

The package can also generate derived images such as thumbnails for images, video's and pdf's. Once you've set up your model, they're easily accessible:

$yourModel->getMedia('images')->first()->getUrl('thumb');

Are you a visual learner?

We've recorded a video course on how to use this package. It's the best way to get started using media library

video course

We have badges!

Latest Version Software License Build Status Quality Score Total Downloads