Mini File Manager
Mini File Manager is a file management interface for your Symfony backend. The connection is made with pentatrion/upload-bundle.
Mini File Manager is very flexible, you can :
- upload big files / resume uploads with resumableJS integration.
- crop / resize / rotate image after their upload.
- custom easily the theme with CSS variables.
- localize the application.
You can see an example here : Live Demo (TinyMCE integration / File Picker with form)
Getting started
if you want a practical minimal installation recipe you can follow this tutorial which will not take you more than 5 minutes.
if you want a full example you can consult the sources of mini-file-manager-template. This example contain full integration of the manager with form (file picker, wysiwyg), and simple file manager.
Dependances
Mini File Manager is designed with Vue (unless you modify the sources, the dependencies are integrated into the module) and you have to configure a Symfony backend to manage your files.
i18n integration, available in English and French or provide your own Translation file. PRs are welcome.
- Symfony v5
- pentatrion/upload-bundle
- liip/imagine-bundle
- symfony/validator
Installation
BackEnd
before you configure the mini-file-manager, you must first install and configure the backend under Symfony with pentatrion/upload-bundle.
FrontEnd
npm install mini-file-manager
Copy dist/file-manager
directory from node_modules/mini-file-manager
to your webroot directory. it contains icons for each file type.
Copy dist/fonts
directory from node_modules/mini-file-manager
to your webroot directory. it contains icons for buttons.
with UMD / ES Modules
mini-file-manager.umd.js
provides miniFileManager
global variable.
<link rel="stylesheet" href="/dist/mini-file-manager.css" />
<div id="file-manager"></div>
<script src="/dist/mini-file-manager.umd.js"></script>
<script>
let {
FileManager,
FileManagerModal,
FormFilePicker
} = miniFileManager;
</script>
or
import {
FileManager,
FileManagerModal,
FormFilePicker
} from "mini-file-manager";
import "mini-file-manager/dist/mini-file-manager.css";
Configuration
Mini File Manager export 3 functions
FileManager(
"#selector",
fileManagerOptions
);
FileManagerModal(
fileManagerOptions,
onSuccess,
onAbort
);
FormFilePicker(
inputElt,
formFilePickerOptions,
fileManagerOptions,
selection
)
const options: FileManagerOptions = {
endPoint: "http://url-to-backend.com/media-manager",
entryPoints: [
{
label: "Conversation",
directory: "projet/mon-projet",
origin: "private_uploads",
readOnly: false,
icon: "fa-lock",
},
],
fileValidation: {
mimeGroup: "image",
allowDir: false,
imageOptions: {
allowSvg: false,
width: 1200,
height: 900,
minWidth: 1200,
maxWidth: 800,
minHeight: 1200,
maxHeight: 800,
ratio: 0.66,
},
}
fileUpload: {
maxFileSize: 500 * 1024 * 1024,
fileType: [
"text/*",
"image/*",
"video/*",
"audio/*",
"application/rtf",
"application/pdf",
"application/xml",
"application/zip",
"font/ttf",
"font/woff",
"font/woff2",
"application/vnd.oasis.opendocument.spreadsheet",
"application/vnd.oasis.opendocument.text",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/msword",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.ms-excel",
"application/json",
"application/illustrator",
]
},
locale: "en",
localeData: {
apply: "foo",
cancel: "bar",
editAndSelect: "baz",
}
multiple: false,
originalSelection: ["posts/autre/ign.jpg"],
theme: "pentatrion-theme"
};
const formFilePickerOptions: FormFilePickerOptions = {
type: "image",
filter: "small",
multiple: true,
};
Theme
if you wants to define your own theme, you can set the theme
option with custom class and redefine the css variables from src/css/variables.css
with this class.
const options = {
theme: 'my-own-theme'
};
.my-own-theme {
--primary-color-light: #fff9d2;
--primary-color: #ffe64b;
--primary-color-active: #fadf30;
--primary-color-dark: #eac800;
}
Screenshots
![Crop image](https://user-images.githubusercontent.com/1088155/128615409-8ba709cf-dd51-40c8-a5f5-93aaacd98fe3.jpg)
Mobile friendly
![Mobile first](https://user-images.githubusercontent.com/1088155/128615401-10dca575-3beb-4cc2-885f-d80498d181d6.jpg)
![Crop mobile first](https://user-images.githubusercontent.com/1088155/128623126-8fdda390-fc3a-455e-a8ad-5f3ab9d7d2e1.jpg)