定制 artisanpack-ui/media-library 二次开发

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

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

artisanpack-ui/media-library

Composer 安装命令:

composer require artisanpack-ui/media-library

包简介

Media library package for ArtisanPack UI

README 文档

README

Tests PHP Version Laravel Version

A comprehensive media management package for Laravel applications with support for image processing, folder organization, tagging, and modern image format conversion (WebP/AVIF).

Features

Core Features

  • 📁 Hierarchical Folder Organization - Organize media into nested folders
  • 🏷️ Tag Management - Tag media items for easy categorization
  • 🖼️ Image Processing - Automatic thumbnail generation in multiple sizes
  • 🚀 Modern Image Formats - Automatic conversion to WebP and AVIF
  • 📦 Storage Abstraction - Support for multiple storage backends via Laravel's filesystem
  • 🎬 Video Support - Video thumbnail extraction using FFmpeg (optional)
  • 🔍 Advanced Search & Filtering - Search by name, filter by type, folder, or tag
  • 🎯 Drag & Drop Upload - Modern upload interface with progress tracking
  • 🖱️ Media Modal Component - Single/multi-select modal for choosing media with context support
  • 🔐 Permission-based Access Control - Granular capability-based permissions
  • 🎨 Publishable Views - Customize all Blade views to match your design
  • 🧪 Comprehensive Test Coverage - Over 500 tests with 90%+ coverage

New in v1.1

  • Livewire 4 Streaming Uploads - Real-time upload progress with wire:stream (automatic fallback for Livewire 3)
  • 📊 Media Statistics Dashboard - KPI cards with sparklines showing upload trends, storage usage, and type distribution
  • 📤 Table Export - Export media library data to CSV, XLSX, or PDF formats
  • 🪟 Glass Effects - Modern glassmorphism UI with customizable blur and transparency
  • 🧩 Visual Editor Integration - MediaPicker component for CMS visual editors with block content helpers
  • ⌨️ Keyboard Navigation - Full keyboard support for media selection (arrow keys, Enter, Escape)
  • 🕐 Recently Used Media - Quick access to recently selected media items
  • ⚙️ Feature Flags - Granular control over features via configuration

Requirements

  • PHP 8.2 or higher (PHP 8.3+ required when using Laravel 13)
  • Laravel 12.0 or 13.0
  • Intervention Image 3.0 for image processing
  • FFmpeg (optional, for video thumbnail extraction)

Installation

Install via Composer:

composer require artisanpack-ui/media-library

Quick Start

// Upload media
$media = apUploadMedia($file, [
    'title' => 'My Image',
    'alt_text' => 'Alt text for accessibility',
    'folder_id' => 1,
]);

// Get media URL
$url = apGetMediaUrl($mediaId, 'thumbnail');

// Display image
$media = apGetMedia($mediaId);
echo $media->displayImage('large', ['class' => 'img-fluid']);

What's New in v1.1

Livewire 4 Streaming Uploads

Real-time upload progress with automatic Livewire 3 fallback:

<livewire:media-upload-zone wire:stream="uploadProgress" />

Visual Editor Integration

Embed the MediaPicker in your CMS visual editor:

<livewire:media-picker
    context="featured-image"
    :allowed-types="['image']"
    :multi-select="false"
/>

Media Statistics Dashboard

Display KPI cards with sparklines:

<livewire:media-statistics
    :show-sparklines="true"
    :sparkline-days="30"
/>

Table Export

Export your media library to various formats:

<x-artisanpack-table-export
    :formats="['csv', 'xlsx', 'pdf']"
    filename="media-export"
/>

AI features

Media Library integrates with artisanpack-ui/ai to offer three vision-powered helpers for image media items. Each feature is toggled through the ai package's feature registry (config('artisanpack.ai.features.*') or the AI settings admin surface).

Feature key Agent What it does
ai.alt_text ArtisanPackUI\Ai\Agents\AltTextGenerationAgent (ships in artisanpack-ui/ai) Suggests accessibility-friendly alt text for an image.
media.suggest_tags ArtisanPackUI\MediaLibrary\Ai\Agents\ImageTagSuggestionAgent Picks matching tags from the existing media_tags taxonomy (opt-in new tags).
media.image_description ArtisanPackUI\MediaLibrary\Ai\Agents\ImageDescriptionAgent Produces a paragraph-length image description for galleries, portfolios, etc.

Surfaces

  • Livewire — the <livewire:media::media-edit> and <livewire:media::media-upload> components gain "AI suggest" buttons next to the alt-text, description, and tag fields. Buttons hide themselves when the feature is disabled or artisanpack-ui/ai is absent.

  • React — the shipped MediaEdit.tsx component wires "Suggest with AI" and "Describe with AI" buttons around the alt-text, description, and tag fields. resources/js/react/utils/api.ts exports typed helpers (suggestMediaAltText, suggestMediaTags, suggestMediaDescription). AI is post-upload only in React/Vue because the JSON endpoints require a persisted media item — the Livewire MediaUpload supports pre-upload suggestions by handing the AI agent a TemporaryUploadedFile directly.

  • Vue — the shipped MediaEdit.vue component mirrors the React wiring. The same helpers are exported from resources/js/vue/utils/api.ts.

  • Any HTTP client — all three features are exposed as JSON endpoints under the existing api/media prefix. Roll your own client if you're not using our React/Vue components:

    POST /api/media/{id}/ai/alt-text                       -> { data: { alt_text, confidence, warnings } }
    POST /api/media/{id}/ai/tags       { allow_new: bool } -> { data: { tags[], new_tags[], confidence } }
    POST /api/media/{id}/ai/description { length: "short" | "medium" | "long" } -> { data: { description, confidence, warnings } }
    

    Each endpoint enforces the update policy on the media item and returns 403 when the feature is disabled, 422 when the target media isn't an image, and 503 when no AI credentials are configured.

Enabling the features

artisanpack-ui/ai is a required dependency starting in v1.3. Configure credentials via config/artisanpack.php or the "AI → Settings" admin page and toggle individual features from "AI → Features".

Documentation

📚 Complete Documentation

Getting Started

Usage

Visual Editor Integration

Dashboard & Statistics

API & Integration

Reference

Testing

Run the test suite:

composer test

Contributing

Contributions are welcome! Please ensure all tests pass and code follows ArtisanPack UI Code Standards.

Security

If you discover a security vulnerability, please send an email to security@artisanpack.com.

Credits

  • Jacob Martella
  • Intervention Image for image processing
  • PHP-FFMpeg for video processing

License

This package is proprietary software developed by ArtisanPack UI.

artisanpack-ui/media-library 适用场景与选型建议

artisanpack-ui/media-library 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 86 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 artisanpack-ui/media-library 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 artisanpack-ui/media-library 我们能提供哪些服务?
定制开发 / 二次开发

基于 artisanpack-ui/media-library 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-03