anomaly/files-module
最新稳定版本:v2.7.0
Composer 安装命令:
composer require anomaly/files-module
包简介
Powerful asset management made easy.
README 文档
README
anomaly.module.files
Powerful asset management made easy.
The Files Module provides comprehensive file and media management with multiple storage adapters and image manipulation capabilities.
Features
- File management interface
- Folder organization
- Multiple storage adapters (local, S3, etc.)
- Image manipulation
- File uploads
- Access control
- Thumbnail generation
- Drag & drop interface
Usage
Uploading Files
use Anomaly\FilesModule\File\Contract\FileRepositoryInterface; $files = app(FileRepositoryInterface::class); // Upload from request $file = $files->upload(request()->file('upload'), $folder); // Create from path $file = $files->create([ 'name' => 'document.pdf', 'folder_id' => $folderId, 'disk_id' => $diskId, 'path' => 'path/to/file.pdf' ]);
Accessing Files
// Get file by ID $file = $files->find(1); // Get file URL $url = $file->path(); // Get thumbnail $thumb = $file->thumbnail('small'); // Get image dimensions $width = $file->width; $height = $file->height;
In Twig
{# Display image #} <img src="{{ image(file).fit(800, 600) }}" alt="{{ file.name }}"> {# With image manipulation #} <img src="{{ image(file).resize(300, 200).quality(90) }}"> {# File download link #} <a href="{{ file.path() }}" download>{{ file.name }}</a> {# Check file type #} {% if file.isImage() %} <img src="{{ file.path() }}"> {% endif %} {# File information #} <p>Size: {{ file.size_human }}</p> <p>Type: {{ file.mime_type }}</p> <p>Uploaded: {{ file.created_at|date('F j, Y') }}</p>
Image Manipulation
{# Resize #} {{ image(file).resize(400, 300) }} {# Fit within bounds #} {{ image(file).fit(800, 600) }} {# Crop #} {{ image(file).crop(200, 200) }} {# Quality #} {{ image(file).quality(85) }} {# Chain methods #} {{ image(file).fit(600, 400).quality(90).blur(5) }}
Requirements
- Streams Platform ^1.10
- PyroCMS 3.10+
- GD or Imagick PHP extension
License
The Files Module is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 50.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-05