承接 anomaly/files-module 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 26
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-05