spescina / mediabrowser by simonpex

Laravel packages that provide a basic user interface for browsing a server folder, for uploading files and for picking a file
566
14
1
Package Data
Maintainer Username: simonpex
Maintainer Contact: s.pescina@gmail.com (Simone Pescina)
Package Create Date: 2014-04-11
Package Last Update: 2019-12-27
Language: PHP
License: MIT
Last Refreshed: 2024-03-26 03:09:47
Package Statistics
Total Downloads: 566
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 14
Total Watchers: 1
Total Forks: 5
Total Open Issues: 0

Build Status Coverage Status

MediaBrowser

Laravel 5.2 package that provide a basic user interface for browsing a server folder, for uploading files and for picking a file

Install && Usage

Run composer require spescina/mediabrowser

Add the service provider in the config/app.php file

Spescina\Mediabrowser\Providers\MediabrowserServiceProvider::class

Publish the package assets running php artisan vendor:publish

Mediabrowser uses Fancybox as IFrame popup loader and for this reason requires jQuery.

Include in your template files Mediabrowser stylesheets

<link media="all" type="text/css" rel="stylesheet" href="http://localhost/packages/spescina/mediabrowser/dist/mediabrowser-include.min.css">

and scripts

<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://localhost/packages/spescina/mediabrowser/dist/mediabrowser-include.min.js"></script>

Now you have to insert an input field and a button for the fancybox trigger, for example

<input type="text" name="yourfield" value="uploads/image.jpg" class="form-control" />
<span class="input-group-btn">
        <a data-fancybox-type="iframe" href="{{ route('mediabrowser', array('yourfield', 'uploads/image.jpg')) }}" class="btn btn-default mediabrowser-js" type="button"><span class="glyphicon glyphicon-folder-open"></span></a>
</span>

Notes

  • The library url can be generated through the mediabrowser named route. It accepts two parameters, field name and optionally the selected value.
  • Mediabrowser is configured for loading optimized assets when your laravel application is not in debug mode.