IMCE ファイルマネージャー
IMCE is an AJAX-based file manager that enables users to browse, upload, and manage files on the server with support for personal directories and user quotas.
imce
インストール
composer require 'drupal/imce:^3.1'
概要
IMCE(Image for TinyMCE)は、サーバー上のファイルを管理するためのAJAXベースのインターフェースを提供する、Drupal用の包括的なファイルマネージャーモジュールです。名前はTinyMCE Editor用の画像ブラウザとしての当初の目的に由来していますが、IMCEはフル機能のファイル管理ソリューションへと進化しました。
このモジュールでは、管理者がフォルダへのアクセス、ファイルアップロード権限、許可するファイル拡張子、サイズ制限、ディスククォータを定義する設定プロファイルを作成できます。これらのプロファイルはファイルシステム(public、privateなど)ごとにユーザーロールに割り当てることができ、きめ細かいアクセス制御が可能です。ユーザートークンを使用した個人フォルダにも対応しており、各ユーザーが専用のディレクトリスペースを持つことができます。
IMCEは、フォルダツリーナビゲーション、ソートオプション付きのファイル一覧、ファイルプレビューパネル、各種操作用のツールバーボタンを備えた、モダンでレスポンシブなユーザーインターフェースを提供します。ファイルのアップロード、新規フォルダの作成、ファイルとフォルダの削除、画像のリサイズに対応しています。CKEditor 5、BUEditor、Drupalネイティブのファイル/画像フィールドウィジェットとの統合により、ユーザーはこれらのコンテキストから直接ファイルを参照・選択できます。
Features
- フォルダツリーナビゲーションとファイル一覧を備えたAJAXベースのファイルブラウザ
- ファイルシステムごとのロールベースアクセス制御用設定プロファイル
- ユーザートークンを使用した個人フォルダ(例:[user:uid]、[user:name])
- 拡張子、サイズ制限、画像サイズのバリデーション付きファイルアップロード
- 使用中のファイルの削除を防ぐファイル使用状況チェック付きファイル削除
- アクセス可能なディレクトリ内での新規フォルダ作成
- コピーオプションとサイズバリデーション付き画像リサイズ
- ユーザーごとのディスククォータ管理
- Drupal画像スタイルを使用したサムネイルプレビューサポート
- 画像およびリンクツールバーボタンによるCKEditor 5統合
- 設定可能なファイルブラウザとしてのBUEditor統合
- 「ファイルブラウザを開く」ボタン付きのファイル/画像フィールドウィジェット統合
- 複数のファイルシステムサポート(public、private、S3など)
- ファイルの絶対URLおよび相対URL生成
- ファイルマネージャーパス用の管理テーマオプション
- セッションベースのアクティブフォルダ記憶機能
Use Cases
Personal user directories
Create personal file spaces for each user by configuring a folder path with user tokens like 'users/user[user:uid]'. Each user will only see and manage files in their own directory, with automatic folder creation on first access.
Role-based media management
Set up different access levels by creating profiles for content editors (full access to shared media folder), authors (upload-only access to their personal folder), and members (view-only access). Assign profiles to roles per file system.
CKEditor 5 image insertion
Allow content editors to insert images from the file server into content. Configure a text format with CKEditor 5, disable built-in image uploads, and use the IMCE image toolbar button. Users can browse, upload, and select images.
Private file downloads
Manage files in the private file system that require authentication. IMCE implements hook_file_download() to validate access, ensuring users can only download files they have IMCE access to.
Image gallery management
Configure a profile with image-only extensions (jpg png gif webp), image dimension limits, and resize permission. Users can upload images that are automatically scaled to maximum dimensions and manually resize existing images.
Multi-site shared storage
Use IMCE with S3 or other remote file systems by enabling 'URL altering' and 'lazy dimensions' options in the profile to handle remote file URLs correctly and improve performance.
Tips
- Create a custom menu item at /imce to provide direct access to the file manager for end users
- Disable CKEditor 5 image uploads to see the IMCE link in the image dialog, or use the dedicated IMCE Image toolbar button
- Use the Duplicate operation to quickly create similar profiles with different settings
- Enable thumbnail previews with caution as they can slow down the file browser with many images
- Use role weight ordering to control which profile takes precedence for users with multiple roles (last assigned wins)
- Enable 'Use admin theme for IMCE paths' if you experience UI issues with your front-end theme
- Personal folders are created automatically when users first access them
- The browser remembers the last active folder in the user session for convenience
Technical Details
Admin Pages 9
/admin/config/media/imce
Main configuration page for IMCE that displays both the settings form and the list of configuration profiles. Administrators can assign profiles to user roles per file system and manage global settings.
/admin/config/media/imce/add-profile
Form for creating a new IMCE configuration profile that defines folder access, permissions, and file restrictions.
/admin/config/media/imce/{imce_profile}
Edit an existing IMCE configuration profile.
/admin/config/media/imce/{imce_profile}/delete
Confirmation form for deleting an IMCE configuration profile.
/admin/config/media/imce/{imce_profile}/duplicate
Creates a copy of an existing configuration profile with a new name.
/admin/imce/help
Help page with documentation and tutorial videos for configuring and using IMCE.
/admin/imce/browser
Administrative file browser interface embedded in an iframe, allowing administrators to manage files directly.
/imce/{scheme}
The main IMCE file browser interface. The {scheme} parameter specifies the file system (public, private, etc.). Defaults to the site's default file system when not specified.
/user/{user}/imce
User profile tab that displays the IMCE file browser for users whose assigned profile has the 'Display file browser tab in user profile pages' option enabled.
権限 1
Hooks 2
hook_imce_supported_widgets_alter
Allows modules to alter the list of supported file field widgets that can integrate with IMCE.
hook_imce_plugin_info_alter
Allows modules to alter IMCE plugin definitions.
Security Notes 7
- The 'administer imce' permission is restricted and grants full access to all file management features
- Anonymous user access warning is displayed when configuring profiles for anonymous role
- File usage checking prevents deletion of files referenced by content unless explicitly disabled
- File name validation prevents directory traversal and special characters
- CSRF token validation protects all AJAX operations
- Personal folder paths with user tokens ensure users cannot access other users' directories
- Files uploaded through IMCE are set as permanent and registered in the file_managed table