semilara/filemanager

Filemanager for Laravel for images

v0.2.0 2020-08-29 13:46 UTC

This package is auto-updated.

Last update: 2025-06-29 02:24:00 UTC


README

Laravel Image Manager for v5.8.

Installation

  1. Add "semilara/filemanager": "dev-master" in your composer.json

  2. Run composer update from your terminal.

  3. Add ServiceProvider to Providers array in config/app.php Semilara\Filemanager\FilemanagerServiceProvider::class,

  4. Publish php artisan vendor:publish --provider="Semilara\Filemanager\FilemanagerServiceProvider" --tag="filemanager" --force

Usage

  1. Add site's non public url to .env's APP_URL

  2. Add these scripts to footer of the page you want to set filemanager to, or set it on global footer

<script src="{{ asset('js/jquery-2.1.1.min.js') }}"></script>
<script src="{{ asset('js/filemanager.js') }}"></script>
  1. Add these to <head> tag
<meta name="csrf-token" content="{{ csrf_token() }}">
<script src="{{ asset('js/app.js') }}" defer></script>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="{{ asset('css/filemanager.css') }}" rel="stylesheet">
<link href="{{ asset('css/font-awesome/css/font-awesome.css') }}" rel="stylesheet">

Note: No need to add csrf-token,app.js and app.css if you are already added.

  1. Add following code to blade file enable file manager
<div class="image-manager-main-div">
                            
    <div style="display: none;" class="image-manager-image-div"><img src="" alt="" title=""/></div>
    <button type="button" class="image-manager-button">Set image</button>
    <input type="hidden" class="thumb-placement" name="image" id="thumb-placement" />

</div>

Note : if you want to use multiple thumbnails on single page then make sure to make id="thumb-placement" unique and take name="image" as an array name="image[]"

Change config

All the default config are set in config/imagemanager.php

  1. Change default folder to load in imagemanager, update imagemanager_path variable. Path should be from root folder
	'imagemanager_path' => 'storage/app/public',
  1. Change supported image types, update allowed_file_extension and allowed_file_mime_types variables.
	'allowed_file_extension' => ['jpg','jpeg','gif','png','webp'],
	'allowed_file_mime_types' => ['image/jpeg','image/pjpeg','image/png','image/x-png','image/gif','image/webp'],
  1. Change Imagemanager list thumbnail width and height, update thumbnail_height and thumbnail_weight variables.
	'thumbnail_height' => '100',
	'thumbnail_width' => '100',

Credit