定制 jdz/mediamanager 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jdz/mediamanager

Composer 安装命令:

composer require jdz/mediamanager

包简介

JDZ media manager

README 文档

README

Framework-agnostic media utilities: file/image upload with automatic resize, and media-folder trees for pickers (images / documents).

Installation

composer require jdz/mediamanager

Upload

JDZ\MediaManager\Upload validates an uploaded file (mime, extension, weight), slugs the filename, moves it into place and downscales large images in-place (GD via Imagine, EXIF autorotate).

use JDZ\MediaManager\Upload;

$upload = new Upload();
$upload->path = '/path/to/public/media/photos/';
$upload->overwrite = false;
$upload->maxPictureLongSide = 1800;

$upload->upload($request->files->get('file')); // Symfony UploadedFile
echo $upload->filename; // slugged, unique, resized if needed

Throws \Exception on unauthorized mime, oversized file or move failure.

Trees

ImageTree builds a nested folders/files structure; DocumentTree builds a flat list with per-type icons. Both skip entries whose basename starts with _, and accept ignore lists.

use JDZ\MediaManager\Tree\ImageTree;
use JDZ\MediaManager\Tree\DocumentTree;

$images = (new ImageTree())
  ->setBasePath($publicPath . 'media/')
  ->setBaseUrl('../media/')
  ->setIgnoreFolders(['template'])
  ->setIgnoreFiles(['share.jpg'])
  ->getTree();
// ['folders' => [['label','path','files' => [...]], ...], 'files' => [['url','id','title','ext'], ...]]

$documents = (new DocumentTree())
  ->setBasePath($publicPath . 'media/')
  ->setBaseUrl('../media/')
  ->getTree();
// [['id','title','text','icon','url','ext'], ...]

Paths are normalized to forward slashes on every platform (Symfony\Filesystem\Path::normalize).

Tests

composer test

License

MIT — see LICENSE.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固