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/style.css
directory from node_modules/mini-file-manager
to your webroot file-manager
directory. it contains your styles 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,
textFormFilePicker,
entityFormFilePicker
} = miniFileManager;
</script>
or
import {
fileManager,
fileManagerModal,
textFormFilePicker,
entityFormFilePicker
} from "mini-file-manager";
import "mini-file-manager/dist/style.css";
Configuration
Mini File Manager export 4 functions
fileManager(
"#selector",
fileManagerOptions
);
fileManagerModal(
fileManagerOptions,
onSuccess,
onAbort
);
textFormFilePicker(
inputElt,
fileManagerOptions,
selection
)
entityFormFilePicker(
"#inputs-container",
fileManagerOptions,
uploadedFiles
onNewFormFiles
)
const options: FileManagerOptions = {
canEditImageSize: true,
canRenameFile: true,
debug: false,
endPoint: "http://url-to-backend.com/media-manager",
entryPoints: [
{
label: "Conversation",
directory: "projet/mon-projet",
origin: "private_uploads",
readOnly: false,
icon: "fa-lock",
},
],
form: {
filter: "small",
type: "image"
}
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",
]
},
fileValidation: {
mimeGroup: "image",
allowDir: false,
imageOptions: {
allowSvg: false,
width: 1200,
height: 900,
minWidth: 1200,
maxWidth: 800,
minHeight: 1200,
maxHeight: 800,
ratio: 0.66,
},
}
indexes: true,
liipResolverPrefix: '/media/cache/resolve'
locale: "en",
localeData: {
apply: "foo",
cancel: "bar",
editAndSelect: "baz",
}
multiple: false,
originalSelection: ["posts/autre/ign.jpg"],
showValidationString: true,
themePrefix: 'penta',
};
Theme
if you wants to define your own theme, you have 2 levels of customization.
- you can define your own css vars following this file :
src/css/variables.scss
:root {
--primary-color500: #ffea66;
--border-radius: .25rem;
}
- you can set the
themePrefix
option with custom class to redefine your buttons in depth.
Screenshots
Mobile friendly