Download the PHP package asignua/filament-image-meta without Composer

On this page you can find all versions of the php package asignua/filament-image-meta. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-image-meta

Filament Image Meta

Stand With Ukraine Latest Version on Packagist Tests Total Downloads License Plumb score

Filament Image Meta

Per-file alt text, a decorative flag, caption, title and a focal point for Filament 5's own FileUpload and SpatieMediaLibraryFileUpload: one wrapper around the upload you already have, no media system to adopt.

Core FileUpload has no per-file metadata at all, and people keep asking for it:

The alternatives are all-or-nothing: Curator solves it if you move your whole media handling into Curator, and the focal-point pickers are a separate field that knows nothing about the upload. This plugin is the small layer in between, with an accessibility and SEO point of view:

Screenshots

Upload row with alt text and status badges

The details modal with alt per language and the focal-point picker

Requirements

Optional: filament/spatie-laravel-media-library-plugin and spatie/laravel-medialibrary for SpatieMediaLibraryFileUpload.

Installation

The plugin registers itself (no panel plugin to add). The focal-point picker is a small Alpine component that is only downloaded by a page that opens the modal. Optionally publish the config:

Usage

Wrap the upload:

SpatieMediaLibraryFileUpload works the same way:

Argument Default
alt true Collect alt text.
decorative true The "Decorative image" switch (alt is cleared and alt="" is rendered).
caption false A caption (for <figcaption>).
title false A title (the title attribute).
focalPoint false The focal-point picker in the modal.
locales [] ['en', 'uk'] = one input per language; empty = one language-less value.
requireAlt false bool or Closure: see Validation.
requiredLocales first of locales Languages that need alt text when requireAlt is on.
statePath {name}_meta Name of the sibling attribute of a plain upload.

Every uploaded image gets a row under the upload: thumbnail, name, the alt text, a status badge (Alt text set, Decorative, Alt text missing, Focal point) and an Edit details button that opens the modal. It works on new, not-yet-saved uploads too.

ImageMetaUpload::make() returns a plain Group that contains the upload and the details panel side by side. Put the result in components([...]); configure the upload (->image(), ->disk(), ->multiple()...) before wrapping it.

Storage

Plain FileUpload

The details are written to a sibling attribute called {name}_meta (photo → photo_meta), as one JSON object keyed by the stored file path:

A language-less field (locales: []) stores plain strings ("alt": "A red door"). Files that are removed take their details with them on save; a new file stored under the path of a removed one starts with no details.

A save rewrites only what the field manages, for every kept file whether its modal was opened or not: the details it does not collect (a field without caption: keeps the stored caption, title and focal point the same way) and the texts in languages outside its locales (an earlier language list, another site or tool) are kept from the stored entry. Marking an image decorative removes its alt text in every language.

SpatieMediaLibraryFileUpload

Nothing to add to the model. After the upload has saved its files, the details are written to the custom_properties of each media item. The property names are configurable (see Configuration); the defaults are alt, alt_decorative, caption, title and focal_point, so a site that already keeps alt / alt_decorative / caption there needs no data migration. Properties the plugin does not manage (credit, ...) are left alone, and so are the details a field does not collect (a field without title: never touches title), and the texts in languages outside the field's locales (alt.pl survives a field with locales: ['en', 'uk']); a detail that is cleared is removed from the media item.

Rendering

:meta takes an ImageMeta or the stored array. Attributes you pass are merged, never duplicated: your own alt or title replaces the stored one, your style is kept.

Reading the details

There is no fallback between languages unless you set image-meta.fallback_locale: an empty Ukrainian alt on /uk is reported as missing rather than showing the English sentence to a screen reader that expects Ukrainian.

Validation

requireAlt: true adds a rule to the details panel (so it also covers images that are already stored): every image must have alt text in the required locales or be marked decorative; the error names the file and is shown under the file list. fallback_locale does not count: a required language needs its own text. requireAlt also takes a closure, e.g. fn () => auth()->user()->isEditor(). By default only the first locale is required (an English-first site that translates later); list more with requiredLocales: ['en', 'uk'].

Configuration

config/image-meta.php:

Key Default
media_properties alt, alt_decorative, caption, title, focal_point Custom property names on a media item.
meta_suffix _meta Sibling attribute of a plain upload.
fallback_locale null Language to fall back to when the requested alt is empty (null = never).
mark_missing_alt false Add data-alt-missing to undescribed images.
alt_max_length 250 Maximum alt text length in the modal; new texts are cut to it on save. Stored texts that are longer are kept as they are.

Gotchas

Translations

English, Ukrainian, German, Spanish, French, Italian, Dutch, Polish, Brazilian Portuguese and Turkish. Publish to override:

AI agents

Laravel Boost guidelines ship in resources/boost/guidelines/core.blade.php.

Testing

The Alpine component is built with npm install && npm run build (esbuild; resources/dist/focal-point.js is committed).

Changelog

See CHANGELOG.

License

The MIT License (MIT). See LICENSE.


All versions of filament-image-meta with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
filament/filament Version ^5.0
illuminate/contracts Version ^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package asignua/filament-image-meta contains the following files

Loading the files please wait ...