balotias/statamic-asset-metadata-importer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

balotias/statamic-asset-metadata-importer

Composer 安装命令:

composer require balotias/statamic-asset-metadata-importer

包简介

Automatically import and map EXIF/IPTC metadata from images to your Statamic asset fields on upload

README 文档

README

Latest Version Total Downloads License Statamic Tests

Statamic Asset Metadata Importer

Automatically import and map EXIF/IPTC metadata from your media to your Statamic asset fields on upload.

📖 Overview

This addon automatically extracts metadata from uploaded images, videos and any supported file types, mapping it to your asset fields. When you upload media with embedded metadata (copyright information, credits, descriptions, etc.), this addon reads that data and populates your asset fields accordingly—saving you time and maintaining consistency across your asset library.

Perfect for photographers, content creators, and anyone managing large media libraries.

✨ Features

  • Automatic metadata extraction on asset upload and re-upload
  • Multiple adapter support - Choose the right tool for each file type
  • Multiple adapter fallback - Try multiple adapters sequentially for better coverage
  • Video file support - Extract metadata from MP4, MOV, AVI, and more
  • Wildcard support - Process all file types or use pattern matching
  • Flexible field mapping - Map any asset field to metadata tags with fallback options
  • Loose mapping mode - Partial matching for flexible extraction
  • Queue support - Async processing for better performance
  • Local and cloud storage - Works with S3, DigitalOcean Spaces, etc.
  • 29,000+ metadata tags - Comprehensive support via Exiftool

📋 Requirements

  • Statamic 5 or 6
  • PHP 8.2 - 8.5
  • (Optional) Exiftool for comprehensive format support ⭐ Recommended
  • (Optional) FFmpeg for video file support
  • (Optional) PHP Imagick extension

📦 Installation

Install via Composer:

composer require balotias/statamic-asset-metadata-importer

Publish the configuration:

php artisan vendor:publish --tag=statamic-asset-metadata-importer-config

🚀 Quick Start

  1. Configure field mappings in config/statamic/asset-metadata-importer.php:
'fields' => [
    'alt' => 'title',
    'copyright' => ['copyright', 'XMP-photoshop:Copyright'],
    'credit' => ['credit', 'XMP-photoshop:Credit'],
],
  1. Set up your adapters (optional, for best results):
'adapter_mapping' => [
    'native' => ['jpg', 'jpeg', 'tif', 'tiff'],
    'exiftool' => ['png', 'webp', 'avif'],      // Requires Exiftool
    'ffprobe' => ['mp4', 'mov', 'avi', 'mkv'],  // Requires FFmpeg
],
  1. Add fields to your asset blueprint:

    • Navigate to Assets → Your Container → Blueprint
    • Add fields: alt, copyright, credit, etc.
  2. Upload your images! Metadata will be extracted automatically.

📚 Documentation

🎯 Adapter System

The addon supports multiple metadata extraction adapters:

Adapter Formats Best For Requirements
Native JPG, TIFF Common images None (built-in)
Exiftool 100+ formats Maximum coverage Install Exiftool
FFprobe Video files Videos Install FFmpeg
ImageMagick 200+ formats Additional formats PHP Imagick extension

💡 Recommendation: Install Exiftool for the best experience. It supports 29,000+ metadata tags across virtually all image and video formats.

Learn more about adapters →

⚙️ How It Works

  1. Asset Upload - You upload an image or video to Statamic
  2. Metadata Extraction - The addon reads embedded metadata using your configured adapter
  3. Field Mapping - Metadata is mapped to asset fields based on your configuration
  4. Automatic Population - Fields are populated automatically

Works seamlessly with both local storage and remote storage (S3, DigitalOcean Spaces, etc.).

💡 Example Use Case

A photographer exports images from Lightroom with embedded metadata:

Image.jpg contains:
- Title: "Sunset over Mountains"
- Copyright: "© 2025 Jane Doe"
- Credit: "Jane Doe Photography"
- Description: "Beautiful sunset in the Alps"

After upload to Statamic, the asset fields are automatically populated:

alt: "Sunset over Mountains"
copyright: "© 2025 Jane Doe"
credit: "Jane Doe Photography"
description: "Beautiful sunset in the Alps"

No manual data entry required! 🎉

🔧 Configuration Examples

Basic Setup (Native Adapter)

'adapter_mapping' => [
    'native' => ['jpg', 'jpeg', 'tif', 'tiff'],
],

Recommended Setup (with Exiftool)

'adapter_mapping' => [
    'exiftool' => ['*'], // Exiftool for everything
],

Different Adapters Setup (All Media Types)

'adapter_mapping' => [
    'native' => ['jpg', 'jpeg', 'tif', 'tiff'],
    'exiftool' => ['png', 'webp', 'avif', 'heic'],
    'ffprobe' => ['mp4', 'mov', 'avi', 'mkv'],
    'imagick' => ['gif', 'bmp'],
],

Multiple Adapter Fallback (NEW)

'adapter_mapping' => [
    'native' => ['jpg'],    // Try native first (fast)
    'exiftool' => ['jpg'],  // Fallback to exiftool if no metadata
],

When multiple adapters are configured for the same extension, they are tried sequentially until metadata is found. This provides better coverage and fallback options.

View full configuration guide →

🐛 Troubleshooting

No metadata imported?

  • Enable debug mode: ASSET_METADATA_IMPORTER_DEBUG=true
  • Check logs at storage/logs/laravel.log
  • Verify field handles match your blueprint

File type not working?

Full troubleshooting guide →

📄 License

MIT License - see LICENSE.md

🙏 Credits

balotias/statamic-asset-metadata-importer 适用场景与选型建议

balotias/statamic-asset-metadata-importer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 01 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「metadata」 「image」 「asset」 「exif」 「IPTC」 「statamic」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 balotias/statamic-asset-metadata-importer 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-08