webplusm/gallery-json-media
A Filament 4 JSON media field for images and documents, with a fluent API and Blade components for Laravel front-ends. Manage galleries, add custom properties, and render photos or document links easily.
Architecture fit
images, documents columns cast to array) via the InteractWithMedia trait and HasMedia contract. There is no media table, no polymorphic relation, and no asset registry — this is a deliberate trade: minimal schema, fast reads for page-render use cases, no ability to query, dedupe, or reuse an asset across records.getMedias(), getDocuments(), withImageProperties(), withView()). The front-end API is decoupled enough to survive a later swap; the admin-side field is tightly coupled to Filament's form internals and will move with every Filament major.Integration feasibility
composer require, publish config, optionally translations and views. First working field is roughly 1–2 hours for a developer already fluent in Filament.spatie/image, a Filament custom theme with the CSS @import added, and storage:link. The theme build is the only step that reliably surprises teams — it means a compiled asset pipeline change, not just a composer line.composer.json: Filament v3 → 3.x, Filament v4 → 4.x, Filament v5 → 5.x. This is a branch-per-Filament-major project, so the constraint is a forward-compatibility commitment, not a version range.Technical risk
webplusm). Treat as a vendored dependency: pin exact versions, mirror the repo, and budget for self-patching.JsonDocumentsEntry downloads are effectively public URLs.gallery-json-media:regenerate command and a maintenance.models registry specifically to backfill dimensions on already-stored records — evidence that schema evolution arrives as data migrations you must plan for.Key questions for the maintainer/team
Stack fit
spatie/image with the GD or Imagick driver, local public disk. Confirm the app is not already multi-node without a shared volume before committing.spatie/laravel-medialibrary with a Filament plugin instead — the visibility constraint will not be worked around cheaply.Migration path
json columns to the target models, add the trait and casts, register getFieldsToDeleteMedia(). No backfill required.image string column: wrap into a one-element array per row in a one-off migration — cheap and reversible.spatie/laravel-medialibrary: write a bespoke command that maps collections to the JSON descriptor shape, leaving files in place, and run both systems in parallel (medialibrary tables read-only) until the Blade templates are cut over. This is a real project, not a migration script.maintenance.models and run gallery-json-media:regenerate --dimensions-only (or full) in staging before production, so responsive srcset and crop ratios are correct at launch rather than after a defect report.Compatibility
Sequencing
storage:link in a built asset.gallery-json-media:regenerate against real data; confirm dimensions and thumbnail regeneration.Maintenance
Support
maintenance.models registration, theme CSS rebuild, and disk-move recovery.Scaling
JsonMediaColumn, expect payload bloat and heavier responses. Cap maxFiles at the field level as a guardrail.maxSize conservative, prefer GD where Imagick memory is a concern, and consider offloading heavy cropping to a queue if galleries grow.Failure modes (ranked by likelihood × damage)
getFieldsToDeleteMedia() only fires on proper Eloquent lifecycle. Silent disk growth; needs a scheduled sweep.editableCustomProperties() gating and editorial process, not code.'array' on the column produces string state and confusing form behavior; enforce in code review.Ramp-up
Media methods (getCropUrl, getCustomProperty, withImageProperties) and for the config surface. New hires will need a short internal note documenting the JSON shape and the regenerate workflow, since the package does not.How can I help you explore Laravel packages today?