PHP code example of balotias / statamic-asset-metadata-importer

1. Go to this page and download the library: Download balotias/statamic-asset-metadata-importer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

balotias / statamic-asset-metadata-importer example snippets


'fields' => [
    'alt' => 'title',
    'copyright' => ['copyright', 'XMP-photoshop:Copyright'],
    'credit' => ['credit', 'XMP-photoshop:Credit'],
],

'adapter_mapping' => [
    'native' => ['jpg', 'jpeg', 'tif', 'tiff'],
    'exiftool' => ['png', 'webp', 'avif'],      // Requires Exiftool
    'ffprobe' => ['mp4', 'mov', 'avi', 'mkv'],  // Requires FFmpeg
],

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

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

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

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

'adapter_mapping' => [
    'native' => ['jpg'],    // Try native first (fast)
    'exiftool' => ['jpg'],  // Fallback to exiftool if no metadata
],
bash
php artisan vendor:publish --tag=statamic-asset-metadata-importer-config